-2
我编写一个SQL Server存储过程以在表中插入图像。 我的存储过程@fPhoto数据类型是图像。有一个错误,我命令它错误。我的代码有什么问题?在delphi中使用存储过程在数据库中存储图像
DM.Connection.StartTransaction;
DM.SP.StoredProcName := 'ProInsert;1';
DM.SP.PrepareSQL(False);
DM.SP.ParamByName('@fPName').Value := NameEdit.Text;
DM.SP.ParamByName('@fPUnit').Value := UnitCMB.ItemIndex + 1;
DM.SP.ParamByName('@fPType').Value := TypeCMB.ItemIndex + 1;
DM.SP.ParamByName('@fPPrice').Value := PriceEdit.Text;
if ProImage.Picture.Graphic = nil then
(DM.SP.ParamByName('@fPhoto') as TBlobField) .Clear //Error
else
begin
F := (DM.SP.FieldByName('@fPhoto') as TBlobField);
S := TStream.Create;
try
S := DM.SP.CreateBlobStream(F, bmWrite);
ProImage.Picture.Graphic.SaveToStream(S);
finally
S.Free;
end;
end;
[dcc32错误] AddProUnit.pas(94):E2010不兼容的类型: 'TUniParam' 和 'TBlobField'