在fb数据库里定义了一个NUMERIC(15,x)类型的字段(存放钱数),怎么用Delphi往存储过程里传参数?下面这样不行:
with SQLStoredProc1.Params.CreateParam(ftCurrency, 'xfje', ptInput) do
AsCurrency:=Edit2.text;
with SQLStoredProc1.Params.CreateParam(ftCurrency, 'xfje', ptInput) do
AsCurrency:=Edit2.text;
with SQLStoredProc1.Params.CreateParam(ftInteger, 'xfje', ptInput) do
AsInteger:=Strtoint(Edit2.text);
下面也不行:
with SQLStoredProc1.Params.CreateParam(ftFloat, 'xfje', ptInput) do
AsFloat:=StrtoFloat(Edit2.text);请教该怎样?
Begin
Name := 'xfje';
Attributes := [paNullable];
DataType := ftFloat;
Direction := pdInput;
Size := 0;
Precision := 10;
End;SQLStoredProc1.Parameters.ParamByName(''xfje').Value :=
qry_op.SQL.Clear;
qry_op.SQL.Add( ' exec SP_MES_HRJCD '+ QuotedStr(Trim(IntToStr(cxImageComboBox1.ItemIndex)))+','+ QuotedStr(Trim(IntToStr(cxImageComboBox2.ItemIndex)))+','+ QuotedStr(Trim(IntToStr(cxImageComboBox3.ItemIndex)))+','+ QuotedStr(FormatDateTime('yyyy/mm/dd',cx_jcrq.Date))+','+
QuotedStr(Trim(_gh))+','+ QuotedStr(Trim(_xm))+','+ QuotedStr(Trim(_cb))+','+ QuotedStr(Trim(_bm))+','+ QuotedStr(Trim(_bmid))+','+ QuotedStr(Trim(_partid))+','+ QuotedStr(Trim(_kb))+','+ QuotedStr(Trim(_xb))+','+ QuotedStr(Trim(_zw))+','+
QuotedStr(Trim(cxMemo1.Lines.Text))+','+ QuotedStr(Trim(cxMaskEdit1.Text))+','+ QuotedStr(Trim(_bmid))); qry_op.ExecSQL;
with SQLStoredProc1.Params.CreateParam(ftCurrency, 'xfje', ptInput) do
AsCurrency:=StrToCurr(Edit2.Text);
變量1:string;
stor.Close;
stor.ProcedureName:='存儲過程名字';
stor.Parameters.Clear;
stor.Parameters.CreateParameter('傳入值1',ftString,pdInput,200,'具體數值');
stor.Parameters.CreateParameter('傳入值2',ftstring,pdInput,200,'具體數值');
stor.Parameters.CreateParameter('傳出值1',ftstring,pdOutput,200,變量1);
stor.ExecProc ;
CurrToStr()
FloatToStr()
Edit1.Text:=format( '%.2f ',[Currency1])
Edit2.Text:=floattostr(Float1)
...