![]() |
Datenbank: SqlExpress • Zugriff über: aDO
TStringStream to BlobStream
Hi
I have a problem when I try use the copyFrom to copy a BlobStream from a StringStream
Delphi-Quellcode:
The field HD_Source not allow null and the error say "cannot insert null value in hd_source"...
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; so, I belive that error is in the line blob.CopyFrom(StringStream, StringStream.size); Can anyone help me? |
Re: TStringStream to BlobStream
Hi,
these lines look a little redundant Zitat:
Zitat:
Regards, Der Unwissende [ADD] If HD_source is non-nullable, you probably should ensure that getHTML returns a valid string (<> '') [/ADD] |
Re: TStringStream to BlobStream
The 2nd parameter of CopyFrom() (the size) can be zero, if you want to copy the whole passed stream. In this case, the source stream will also be seeked to position 0 before copy. Otherwise (if you pass any size value > 0), you have to ensure that the read position is as expected on zero position before calling CopyFrom()
|
Alle Zeitangaben in WEZ +1. Es ist jetzt 09:47 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 by Thomas Breitkreuz