1

我的平台 Delphi 2007 和 SQL Server 2008 R2 当我发布我的TAdoDataset时,我在 Sql profiler 中收到此代码:

exec sp_executesql N'UPDATE "MYDBNAME"."dbo"."HESAPISL" SET "ADET"=@P1,"FIYAT"=@P2,"TARIFEID"=@P3,"KRMTUTAR"=@P4,"SGTUTAR"=@P5,"OZELTUTAR"=@P6,"HSTKATKITUTAR"=@P7,"KRMINDORAN"=@P8,"KRMINDTUTAR"=@P9,"OZELINDORAN"=@P10,"OZELINDTUTAR"=@P11,"SGINDORAN"=@P12,"HIKUTUICIADET"=@P13,"HSTKDVORAN"=@P14,"KRMKDVORAN"=@P15,"SGKDVORAN"=@P16,"EKMASRAFTUTAR"=@P17,"HSTPAKETDURUMUID"=@P18,"KRMPAKETDURUMUID"=@P19,"SGPAKETDURUMUID"=@P20,"HSTPAKETEDAHIL"=@P21,"KRMPAKETEDAHIL"=@P22,"SGPAKETEDAHIL"=@P23,"ESKIITEMID"=@P24,"ESKIADET"=@P25,"ESKIHIKUTUICIADET"=@P26,"HSTFYTTUTAR"=@P27,"HKMATRAH"=@P28,"MLYTTUTAR"=@P29,"BAZFYTBIRIM"=@P30 
WHERE "ADET"=@P31 AND "FIYAT"=@P32 AND "TARIFEID"=@P33 AND "KRMTUTAR"=@P34 AND "SGTUTAR"=@P35 AND "OZELTUTAR"=@P36 AND "HSTKATKITUTAR"=@P37 AND "KRMINDORAN"=@P38 AND "KRMINDTUTAR"=@P39 AND "OZELINDORAN"=@P40 AND "OZELINDTUTAR"=@P41 AND "SGINDORAN"=@P42 AND "HIKUTUICIADET"=@P43 AND "HSTKDVORAN"=@P44 AND "KRMKDVORAN"=@P45 AND "SGKDVORAN"=@P46 AND "EKMASRAFTUTAR"=@P47 AND "HSTPAKETDURUMUID"=@P48 AND "KRMPAKETDURUMUID"=@P49 AND "SGPAKETDURUMUID"=@P50 AND "HSTPAKETEDAHIL"=@P51 AND "KRMPAKETEDAHIL"=@P52 AND "SGPAKETEDAHIL"=@P53 AND "ESKIITEMID" IS NULL AND "ESKIADET" IS NULL AND "ESKIHIKUTUICIADET" IS NULL AND "HSTFYTTUTAR"=@P54 AND "HKMATRAH"=@P55 AND "MLYTTUTAR"=@P56 AND "BAZFYTBIRIM"=@P57 AND "HESAPISLID"=@P58 AND "HESAPISLID" IS NULL',N'@P1 float,@P2 float,@P3 int,@P4 float,@P5 float,@P6 float,@P7 float,@P8 float,@P9 float,@P10 float,@P11 float,@P12 float,@P13 numeric(9,2),@P14 numeric(5,2),@P15 numeric(5,2),@P16 numeric(5,2),@P17 float,@P18 int,@P19 int,@P20 int,@P21 bit,@P22 bit,@P23 bit,@P24 int,@P25 float,@P26 numeric(8,2),@P27 float,@P28 float,@P29 float,@P30 numeric(19,4),@P31 float,@P32 float,@P33 int,@P34 float,@P35 float,@P36 float,@P37 float,@P38 float,@P39 float,@P40 float,@P41 float,@P42 float,@P43 numeric(9,2),@P44 numeric(5,2),@P45 numeric(5,2),@P46 numeric(5,2),@P47 float,@P48 int,@P49 int,@P50 int,@P51 bit,@P52 bit,@P53 bit,@P54 float,@P55 float,@P56 float,@P57 numeric(19,4),@P58 int',4,0,078299999999999995,4,0,0,0,31319999999999998,0,0,0,0,0,0,30.00,8.00,8.00,8.00,0,00013333333333337416,0,0,0,0,0,0,7516,6,30.00,0,31333333333333335,0,0,0,6,0,078299999999999995,4,0,0,0,4698,0,0,0,0,0,0,30.00,8.00,8.00,0,0,00020000000000003348,0,0,0,0,0,0,0,47000000000000003,0,0,2.3500,53791

例子:

HSTKDVORAN = 8.00(这没问题!没问题)

FIYAT = 0,078299999999999995(这导致异常/问题)

浮点字段值以逗号分隔。

当我运行此代码(在 SQL Management Studio 中)时,出现错误:

Msg 8144, Level 16, State 2, Line 0
Procedure or function has too many arguments specified.

我该如何解决?

4

1 回答 1

0

如果 FIYAT = 0,078299999999999995 则程序还有一个值(0 和 078299999999999995) FIYAT 必须为 0.078299999999999995

您可以使用 TAdoDataSet 或 TAdoCommand 设置属性 CommandType: cmdStoredProc 并从属性 Commandtext 中选择存储过程。从属性参数中,您可以看到存储过程的所有参数。

<TADODataSet>.Parameters.ParamByName('@FIYAT').Value:=0.078299999999999995;
<TADODataSet>.Parameters.ParamByName('@FIYAT').Value:='0,078299999999999995';  --> not ok

值是变体。你必须指定你的论点

如果使用 TAdoDataset 链接表 MYDBNAME.dbo.HESAPISL

property CommandType: cmdText
property CommandText: 'select HSTKDVORAN, FIYAT from MYDBNAME.dbo.HESAPISL';

<TAdoDataset>.FieldByName('FIYAT').AsFloat:= 0.078299999999999995;

评论中的代码

 tHILACMALZ1ADET.Value := tHILACMALZADET.AsFloat; 
 tHILACMALZ1HIKUTUICIADET.Value := FDM.tITEMKUTUICIADET.AsFloat; 
 tHILACMALZ1.Post; 

在某一方面的变化

 tHILACMALZ1ADET.AsFloat:= tHILACMALZADET.AsFloat; 
 tHILACMALZ1HIKUTUICIADET.AsFloat:= FDM.tITEMKUTUICIADET.AsFloat; 
 tHILACMALZ1.Post; 
于 2012-09-13T09:11:50.357 回答