这样一句简单的数据库操作语句为什么会出错? adoquery1.SQL.Add('update upload set period='+label3.Caption+',times='+label4.Caption+',corp_id='+label2.Caption+'');period 是文本的times corp_id都是数字形 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 adoquery1.SQL.Add('update upload set period='''+label3.Caption+''',times='+label4.Caption+',corp_id='+label2.Caption+''); adoquery1.SQL.Add('update upload set period='''+label3.Caption+''',times='+label4.Caption+',corp_id='+label2.Caption); adoquery1.SQL.Add('update upload set period='+QuotedStr(label3.Caption)+',times='+QuotedStr(label4.Caption)+',corp_id='+QuotedStr(label2.Caption)); 提示什么错误?前面注意加个adoquery.sql.clear; adoquery1.SQL.Add('update upload set period='''+label3.Caption+''',times='''+label4.Caption+''',corp_id='''+label2.Caption+''''); 看你是什么数据库,涉及到类型转换问题了因为你的times和corp_id都是数值型,采用convert或者to_number类似的函数来转换像楼上的写的只能针对字符型的,数值、日期型的就需要转换,里面的参数自己查下例如:adoquery1.SQL.Add('update upload set period='''+label3.Caption+''',times=convert('+label4.Caption+'),corp_id='+label2.Caption+''); sql server 就用convert函数转换,oracle就用to_number转换,日期的用to_date adoquery1.sql.clear;adoquery1.SQL.Add('update upload set period='''+label3.Caption+''',times='''+label4.Caption+''',corp_id='''+label2.Caption+''''); adoquery1.SQL.Add('update upload set period='''+label3.Caption+''',times='+label4.Caption+',corp_id='+label2.Caption);这个对了~ 关于截获系统消息的问题 求一分类汇总的 SQL语句... Delphi与Flash交互 在线,求如何获得MP3文件播放时间 Delphi8下载! 还是小问题!!!大家指点!!! 怎样得到C盘下所有的目录名,只要回答就给分。 如何正确获得MAC地址(没有实际经验的莫看) 我的程序缩小到工作闸,那么要鼠标到它上面才可以显示提示消息.我如何控制提示消息自动显示一段时间消失 用delphi控制word,如何替换word中页眉文字,或者设置页眉 dxGrid的Colums合计发生变化,是触发那个事件,,,求助啊。。。。 如何用QUERY去取SEQUENCE里面的数据
前面注意加个adoquery.sql.clear;
因为你的times和corp_id都是数值型,采用convert或者to_number类似的函数来转换
像楼上的写的只能针对字符型的,数值、日期型的就需要转换,里面的参数自己查下
例如:
adoquery1.SQL.Add('update upload set period='''+label3.Caption+''',times=convert('+label4.Caption+'),corp_id='+label2.Caption+'');
adoquery1.SQL.Add('update upload set period='''+label3.Caption+''',times='''+label4.Caption+''',corp_id='''+label2.Caption+'''');
adoquery1.SQL.Add('update upload set period='''+label3.Caption+''',times='+label4.Caption+',corp_id='+label2.Caption);这个对了~