-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'