繁体   English   中英

Delphi TAdoDataset TFloatField逗号错误

Delphi TAdoDataset TFloatField comma error

提示:本站收集StackOverFlow近2千万问答,支持中英文搜索,鼠标放在语句上弹窗显示对应的参考中文或英文, 本站还提供   中文繁体   英文版本   中英对照 版本,有任何建议请联系yoyou2525@163.com。

我的平台Delphi 2007和SQL Server 2008 R2当我发布TAdoDataset ,我在Sql事件探查器中收到以下代码:

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.

我该如何解决?

1 个回复

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

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

<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; 
1 TADODataset在Delphi中捕获Post方法错误代码

我有一个数据集,并且正在使用它来捕获错误: 这是一个糟糕的解决方案,因为它依赖于在错误消息上找到字符串“ duplicate value”或“ duplicate key”。 我希望能够获得一些错误代码。 有什么办法吗? ...

2019-05-24 19:01:27 1 93   delphi
6 在MS Access中使用TADODataset组件时出错

我正在尝试用MS Access DB替换InterBase DB作为测试,我已成功使用TADOConnection组件连接到MS Access DB。 但是,当我尝试使用TADODataset连接到表时,我能够将Connection属性设置为TADOConnection组件,但是当我想设置Co ...

7 ADO查询中的Delphi 7语法错误(逗号)

我正在尝试在Delphi 7中使用SQL查询在数据库中创建一条记录。我正在使用ADO查询,并且尝试了使用和不使用参数,但均无济于事。 该错误发生在ShowMessage 1和2之间。 注释掉的部分是我尝试执行此操作的一种方法,它给出了此错误: 带参数的代码给我这个错误: 任 ...

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2021 STACKOOM.COM