delphi 7 至少一个参数没有被指定值
时间:2011-09-02
来源:互联网
程序功能:将EXCEL导入access 数据库表t_productproperty(t1) 中,并将表t_shippingCost(t2)中对应的值更新到表t1中
代码如下:
Delphi(Pascal) code
错误:点击按钮后弹出异常:Project cost.exe raised exception class eolexception with message '至少一个参数没有被指定值 '………………
请问这是什么原因呢?
谢谢大家的关注 。
代码如下:
Delphi(Pascal) code
procedure TFinput_ZZ.btnSelectAndInputClick(Sender: TObject); var sqlstr : string; begin //导入数据库 sqlstr := 'insert into t_ProductProperty(Fyear,FPeriod,FFactory,FName,FWeight,FWireWeight) SELECT * FROM [EXCEL 8.0;DATABASE=D:\excel\成品属性表.XLS].[SHEET1$]'; with datamd.adoproductProperty do begin close; sql.Clear; parameters.Clear; paramcheck := false; sql.Add(sqlstr); execsql; end; //更新表t_productProperty中shipping字段 with datamd.adoproductProperty do begin close; sql.Clear; sqlstr := 'update t_productProperty t1,t_shippingCost t2 set t1.fshipping = (t2.fshippingCost)*(t1.weight) where t1.fyear = t2.fyear and t1.fperiod = t2.fperiod and t1.factory = t2.factory '; sql.Add(sqlstr); execSQL; end; showmessage('导入成功'); end;
错误:点击按钮后弹出异常:Project cost.exe raised exception class eolexception with message '至少一个参数没有被指定值 '………………
请问这是什么原因呢?
谢谢大家的关注 。
作者: lvlufeng 发布时间: 2011-09-02
你不能select * 啊,你得保证前后字段完全对应
作者: bdmh 发布时间: 2011-09-02
引用 1 楼 bdmh 的回复:
你不能select * 啊,你得保证前后字段完全对应
你不能select * 啊,你得保证前后字段完全对应
您好,谢谢您 的回答,可是前一段代码测试是成功的,能成功导入
加了下面一段后再运行就出错了:
Delphi(Pascal) code
//更新表t_productProperty中shipping字段 with datamd.adoproductProperty do begin close; sql.Clear; sqlstr := 'update t_productProperty t1,t_shippingCost t2 set t1.fshipping = (t2.fshippingCost)*(t1.weight) where t1.fyear = t2.fyear and t1.fperiod = t2.fperiod and t1.factory = t2.factory '; sql.Add(sqlstr); execSQL; end;
搞不清原因
作者: lvlufeng 发布时间: 2011-09-02
你的SQL语句写错了。可能是这样的吧
SQL code
SQL code
update t_productProperty set fshipping = (t2.fshippingCost)*(t1.weight) from t_productProperty t1,t_shippingCost t2 where t1.fyear = t2.fyear and t1.fperiod = t2.fperiod and t1.factory = t2.factory
作者: moshao6 发布时间: 2011-09-02
引用 3 楼 moshao6 的回复:
你的SQL语句写错了。可能是这样的吧
SQL code
update t_productProperty set fshipping = (t2.fshippingCost)*(t1.weight)
from t_productProperty t1,t_shippingCost t2
where t1.fyear = t2.fyear and t1.f……
你的SQL语句写错了。可能是这样的吧
SQL code
update t_productProperty set fshipping = (t2.fshippingCost)*(t1.weight)
from t_productProperty t1,t_shippingCost t2
where t1.fyear = t2.fyear and t1.f……
您好,谢谢您 的回答 改成这样之后确实那个错误没有了
Delphi(Pascal) code
//导入数据并更新单位运费 procedure TFinput_ZZ.btnSelectAndInputClick(Sender: TObject); var sqlstr : string; begin sqlstr := 'insert into t_ProductProperty(Fyear,FPeriod,FFactory,FName,FWeight,FWireWeight) SELECT * FROM [EXCEL 8.0;DATABASE=D:\excel\成品属性表.XLS].[SHEET1$]'; with datamd.adoproductProperty do begin close; sql.Clear; parameters.Clear; paramcheck := false; sql.Add(sqlstr); execsql; end; with datamd.adoproductProperty do begin close; sql.Clear; sqlstr := 'update t_productProperty set t1.fshipping = (t2.fshippingCost)*(t1.fweight) from t_productProperty t1 ,t_shippingCost t2 where t1.fyear = t2.fyear and t1.fperiod = t2.fperiod and t1.factory = t2.factory '; sql.Add(sqlstr); execSQL; end; showmessage('导入成功'); end;
但是它说:
语法错误(缺少操作符)在查询表达式Delphi(Pascal) code
(t2.fshippingCost)*(t1.weight) from t_productProperty t1,语法错误(缺少操作符)
作者: lvlufeng 发布时间: 2011-09-02
相关阅读 更多
热门阅读
-
office 2019专业增强版最新2021版激活秘钥/序列号/激活码推荐 附激活工具
阅读:74
-
如何安装mysql8.0
阅读:31
-
Word快速设置标题样式步骤详解
阅读:28
-
20+道必知必会的Vue面试题(附答案解析)
阅读:37
-
HTML如何制作表单
阅读:22
-
百词斩可以改天数吗?当然可以,4个步骤轻松修改天数!
阅读:31
-
ET文件格式和XLS格式文件之间如何转化?
阅读:24
-
react和vue的区别及优缺点是什么
阅读:121
-
支付宝人脸识别如何关闭?
阅读:21
-
腾讯微云怎么修改照片或视频备份路径?
阅读:28