AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

Blob field save AsString into DB

Ein Thema von question · begonnen am 6. Sep 2013 · letzter Beitrag vom 6. Sep 2013
 
Perlsau
(Gast)

n/a Beiträge
 
#2

AW: Blob field save AsString into DB

  Alt 6. Sep 2013, 09:48
What does this blob field represent? If you would fill a TMemo or a TRichEdit with the contents of this blob field, it would be okay. But if you want do represent a picture, a wave form or something like this it could be a problem to write/read it as string. Normally you read and write blob data by TFileStream or TMemoryStream:

Delphi-Quellcode:
function TDatMod.File_To_Blob(FileName: String; BlobFeld: TField): Boolean;
VAR
   S : TStream;
   FileS : TFileStream;

begin
     Result := FALSE;
     IF NOT FileExists(FileName) THEN EXIT;

     S := BlobFeld.DataSet.CreateBlobStream(BlobFeld, bmReadWrite);
     TRY
        FileS := TFileStream.Create(FileName, fmOpenRead);
        S.CopyFrom(FileS, FileS.Size);
        Result := TRUE;
     FINALLY
        FileS.Free;
        S.Free;
     END;
end;

function TDatMod.Blob_To_File(FileName: String; BlobFeld: TField): Boolean;
VAR
   S : TStream;
   FileS : TFileStream;

begin
     Result := FALSE;
     IF BlobFeld.IsNull THEN EXIT;

     S := BlobFeld.DataSet.CreateBlobStream(BlobFeld, bmRead);
     TRY
        FileS := TFileStream.Create(FileName, fmCreate);
        FileS.CopyFrom(S, S.Size);
        Result := TRUE;
     FINALLY
        S.Free;
        FileS.Free;
     END;
end;
  Mit Zitat antworten Zitat
 


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 21:01 Uhr.
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz