![]() |
Blob field save AsString into DB
Hi,
I have a Bolb field 'CollectID' in the DB and i am saving the data into this Blob Field AsString in the following way,
Code:
its working fine,but i am not sure is that okay or it can be problem in future
QueryA.ParamByName('CollectID').AsString := QueryB.FieldByName('CollectID').AsString;
|
AW: Blob field save AsString into DB
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; |
AW: Blob field save AsString into DB
it does not fill picture, it filled with binary text, in this situtation, is that okay to use it
Code:
by the way, i have another problem, i have reinstalled the database and now the Blob field is not working in the whole application,dont know why,have you any suggestion?
QueryA.ParamByName('CollectID').AsString := QueryB.FieldByName('CollectID').AsString;
|
AW: Blob field save AsString into DB
Is the BLOB-field accessable using an administration-tool? If not, it is quite senseless to try to access it by your application and search for errors there.
|
AW: Blob field save AsString into DB
Hi,
thanks for your important information but there is no administration-tool to access the BLOB-field in this situation,how can i overcome this problem? |
AW: Blob field save AsString into DB
Most administration-tools I know offer several options for BLOB-fields such as "view as text" or "view as picture". Maybe you have to search for them a little bit.
|
AW: Blob field save AsString into DB
initiative of his/her own isn't questions kind. Thus he/she doesn't even try to understand answers and insits on his/her pov.
![]() @question If your solution works than be happy. We tried to told you several times that a blob isn't a normal field, and when you refuse to recognize it and not using an better solution than your easier but maybe buggy version, than do it on your own responsibility! |
Alle Zeitangaben in WEZ +1. Es ist jetzt 04:34 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz