procedure TForm1.FormCreate(Sender: TObject);
var
tmpMemStream: TMemoryStream;
tmpPic: TPicture;
tmpSize: LongInt;
tmpStr,AFileName: String;
aa: TStringStream;
AValue: AnsiString;
APicture: TPicture;
begin
ADOQuery1.Open;
// if not ADOTable1.Active then ADOTable1.Active:=True;
//ADOTable1.first;
while not ADOQuery1.eof do begin
if not ADOQuery1.Fieldbyname('PrintFileName').IsNull then
begin
tmpMemStream := TMemoryStream.Create;
tmpMemStream.LoadFromFile(ADOQuery1.Fieldbyname('PrintFileName').AsString);
tmpSize := tmpMemStream.Size;
SetLength(tmpStr, tmpSize);
tmpMemStream.Read(tmpStr[1], tmpSize);
tmpMemStream.Free;
cxGrid1DBTableView1.DataController.SetValue(cxGrid1DBTableView1.DataController.RecNo-1, cxGrid1DBTableView1Column3.Index, tmpStr);
end;
ADOQuery1.Next;
end;
(*while not ADOQuery1.eof do
begin
if not ADOQuery1.Fieldbyname('PrintFileName').IsNull then
begin
AFileName := ADOQuery1.Fieldbyname('PrintFileName').AsString;
if FileExists(AFileName) then
begin
APicture := TPicture.Create;
try
APicture.LoadFromFile(AFileName);
SavePicture(APicture, AValue);
finally
FreeAndNil(APicture);
end;
end
else
AValue := '';
self.cxGrid1DBTableView1.DataController.Values[ADOQuery1.RecNo-1, cxGrid1DBTableView1Column3.Index] := AValue;
end;
ADOQuery1.Next;
end; *)
cxGrid1DBTableView1Column3为Variant类型,BlobEdit类型下拉列表。
————————————————
版权声明:本文为CSDN博主「9807146wang」的原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/9807146wang/article/details/7238258