Einzelnen Beitrag anzeigen

mr_fahrrad

Registriert seit: 28. Dez 2006
46 Beiträge
 
#1

TStringStream to BlobStream

  Alt 9. Jan 2007, 18:02
Datenbank: SqlExpress • Zugriff über: aDO
Hi

I have a problem when I try use the copyFrom to copy a BlobStream from a StringStream



Delphi-Quellcode:
procedure TfrmHelpEdt.sButton2Click(Sender: TObject);
var
blob:TStream;
StringStream : TStream;
begin

  with ADOTbl_HTDATA do //is a AdoTable
    begin
      Active:=true;
      Insert;
       blob:=CreateBlobStream(FieldByName('HD_source'), bmWrite);
       StringStream:=TStringStream.Create(getHtml); //getHTML function Return a string
       blob.Position:=0;
       blob.Seek(0, soFromBeginning);
       blob.CopyFrom(StringStream, StringStream.size);
      Post;
      Active:=false;
    end;
The field HD_Source not allow null and the error say "cannot insert null value in hd_source"...
so, I belive that error is in the line blob.CopyFrom(StringStream, StringStream.size);

Can anyone help me?
  Mit Zitat antworten Zitat