Home > Back-end >  Read binary field values
Read binary field values

Time:10-14

Before used Delphi development
Now run into a problem
S_sql:='SELECT * FROM table';
ADOl. Close ();
ADOl. SQL. The Clear ();
ADOl. SQL. The Add (s_sql);
ADOl. Open;
Table has a field 1, field 1 type as an image, ask ADOdzbl. FieldByName (' field 1). Why couldn't take the Value Value,

CodePudding user response:

This the blob stream out!

CodePudding user response:

How to write the specific detailed said the younger brother novice, is not

CodePudding user response:

TBlobField (ADOdzbl Fieldbyname (' field 1)). SaveToFile (ExtractFilePath (Application. ExeName) + 'a. peg');

CodePudding user response:

So I know heel
Ms:=TMemoryStream (ADOdzbl. CreateBlobStream (ADOdzbl. FieldByName (' medical record content), bmRead));
Ms. SaveToFile (' c: \ ddd1 XML);
About, keep the binary stream into the file, I now is to use the binary stream, give out binary stream assignment to a variable to another function, save a file is complex, the binary stream how to assign a value to variable, in the form of a parameter to another function (the parameter type OleVariant)

CodePudding user response:

 
Var
Ms: TMemoryStream;
The begin
TBlobField (ADOdzbl FieldbyName (' field 1)). SaveToStream (ms).
end;

CodePudding user response:

Sream OleVariant is try down the following functions:

Quote from: http://blog.csdn.net/xt_chaoji/article/details/6891360

 
The function TForm1. StreamToVariant (Stream: TStream) : OleVariant;
Var
P: Pointer;
The begin
Result:=VarArrayCreate ([0, Stream. Size - 1], varByte);
P:=VarArrayLock (Result);
Try
Stream. Position:=0;
Stream. Read (p ^, Stream. Size);
The finally
VarArrayUnlock (Result);
end;
end;

CodePudding user response:

This saved into TMemoryStream type, is passed to another function parameter type OleVariant, type mismatch, struggle to it,

CodePudding user response:

refer to 7th floor lgg666 response:
this saved into TMemoryStream type, is passed to another function parameter type OleVariant, type mismatch, struggle to this,


Try the above function: StreamToVariant
  • Related