S
sxj0704
Unregistered / Unconfirmed
GUEST, unregistred user!
代码如下:
procedure TBlobForm.Button1Click(Sender: TObject);
var
FS: TFileStream;
//T:TBlobField;
begin
//T:=TBlobField.Create(self);
//ADODatasetImage.DataSet :=ADODataset1;
//end;
begin
//T:=TBlobField.Create(TBlobField(adodataset1.FieldByName('BLOBFILE')),bmWrite);
if opendialog1.execute then
begin
image1.picture.loadfromfile(opendialog1.filename);
if not (ADODataset1.State in [dsInsert, dsEdit]) then
ADODataset1.Edit;
ADODataset1.Insert ;
FS := TFileStream.Create(opendialog1.FileName , fmOpenRead);
try
//T.Clear ;
// T.DataSet :=ADODataset1;
ADODataset1.LoadFromFile(FS); //ADODatasetImages是一个TBlobField
finally
Free;
end;
ADODataset1.Post ;
end;
end;
end;
end.
运行时显示“FS和ADODataset.LoadFromFile的字符串格式不一致”,抱错
Listen to you
procedure TBlobForm.Button1Click(Sender: TObject);
var
FS: TFileStream;
//T:TBlobField;
begin
//T:=TBlobField.Create(self);
//ADODatasetImage.DataSet :=ADODataset1;
//end;
begin
//T:=TBlobField.Create(TBlobField(adodataset1.FieldByName('BLOBFILE')),bmWrite);
if opendialog1.execute then
begin
image1.picture.loadfromfile(opendialog1.filename);
if not (ADODataset1.State in [dsInsert, dsEdit]) then
ADODataset1.Edit;
ADODataset1.Insert ;
FS := TFileStream.Create(opendialog1.FileName , fmOpenRead);
try
//T.Clear ;
// T.DataSet :=ADODataset1;
ADODataset1.LoadFromFile(FS); //ADODatasetImages是一个TBlobField
finally
Free;
end;
ADODataset1.Post ;
end;
end;
end;
end.
运行时显示“FS和ADODataset.LoadFromFile的字符串格式不一致”,抱错
Listen to you