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
Antwort Antwort
question

Registriert seit: 17. Apr 2013
97 Beiträge
 
#1

Blob field save AsString into DB

  Alt 6. Sep 2013, 07:57
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:
QueryA.ParamByName('CollectID').AsString := QueryB.FieldByName('CollectID').AsString;
its working fine,but i am not sure is that okay or it can be problem in future
  Mit Zitat antworten Zitat
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
question

Registriert seit: 17. Apr 2013
97 Beiträge
 
#3

AW: Blob field save AsString into DB

  Alt 6. Sep 2013, 09:57
it does not fill picture, it filled with binary text, in this situtation, is that okay to use it
Code:
QueryA.ParamByName('CollectID').AsString := QueryB.FieldByName('CollectID').AsString;
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?
  Mit Zitat antworten Zitat
Benutzerbild von DeddyH
DeddyH

Registriert seit: 17. Sep 2006
Ort: Barchfeld
27.545 Beiträge
 
Delphi 11 Alexandria
 
#4

AW: Blob field save AsString into DB

  Alt 6. Sep 2013, 10:04
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.
Detlef
"Ich habe Angst vor dem Tag, an dem die Technologie unsere menschlichen Interaktionen übertrumpft. Die Welt wird eine Generation von Idioten bekommen." (Albert Einstein)
Dieser Tag ist längst gekommen
  Mit Zitat antworten Zitat
question

Registriert seit: 17. Apr 2013
97 Beiträge
 
#5

AW: Blob field save AsString into DB

  Alt 6. Sep 2013, 10:09
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?
  Mit Zitat antworten Zitat
Benutzerbild von DeddyH
DeddyH

Registriert seit: 17. Sep 2006
Ort: Barchfeld
27.545 Beiträge
 
Delphi 11 Alexandria
 
#6

AW: Blob field save AsString into DB

  Alt 6. Sep 2013, 10:14
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.
Detlef
"Ich habe Angst vor dem Tag, an dem die Technologie unsere menschlichen Interaktionen übertrumpft. Die Welt wird eine Generation von Idioten bekommen." (Albert Einstein)
Dieser Tag ist längst gekommen
  Mit Zitat antworten Zitat
mkinzler
(Moderator)

Registriert seit: 9. Dez 2005
Ort: Heilbronn
39.851 Beiträge
 
Delphi 11 Alexandria
 
#7

AW: Blob field save AsString into DB

  Alt 6. Sep 2013, 10:22
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.

http://www.delphipraxis.net/176416-d...-new-post.html

@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!
Markus Kinzler
  Mit Zitat antworten Zitat
Antwort Antwort


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 17:57 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