Hi
I have 16-byte field defined as 'MD5Digest: array [0..15] of byte' in Delphi and defined as 'Binary(16)' in the table.
This is how I set parameter in TMSQuery (when I do Insert):
qryMD5.ParamByName('MD5').SetBlobData(@MD5Digest, SizeOf(MD5Digest));
This is how I read that value later from the table (using another TMSQuery):
qryGetMD5.FieldByName('MD5').GetData(@MD5Digest);
It seems that I am getting correct results.
Is this correct? If not, what is the proper syntax? In Insert statement can I use SetData(pointer) instead of SetBlobData(pointer, length)?
D2006, latest SDAC version, MSSQL 2005.
Thanks
Zoran
SetBlobData and GetData syntax
The way you work with BLOB fields is correct, but we recommend you to use a TBlob object.
The TBlob object holds large object value for field and parameter.
You can use it like shown
For more information about TBlob class please see SDAC help.
The TBlob object holds large object value for field and parameter.
You can use it like shown
Code: Select all
uses
MemData ...
procedure TForm1.FormCreate(Sender: TObject);
var
Blob: TBlob;
MD5Digest: array [0..15] of byte;
begin
Blob := MSQuery.GetBlob('BlobField');
Blob.Read(0, Length(MD5Digest), @MD5Digest[0]);
...
Blob.Write(0, Length(MD5Digest), @MD5Digest[0]);
For more information about TBlob class please see SDAC help.