string s_chehao
string s_cdlcode
date d_riqi
d_riqi=today()
s_chehao=parent.ddlb_1.text
s_cdlcode=parent.sle_1.text//获取发货单号
string mysql
mysql="INSERT INTO two_ck_main (cDLCode,dDate,cChehao) VALUES(:"+ s_cdlcode+",:"+d_riqi+",:"+s_chehao+")"
//sql插入语句
//dw_2.setsqlselect( mysql)
EXECUTE IMMEDIATE :mysql
if sqlca.sqlcode = 0 then
commit;
messagebox( "提示 ", "插入成功 ")
else
messagebox( "提示 ", "插入失败 ")
rollback;
end if
以上代码执行不成功,哪位高手看看出了什么问题
------解决方案--------------------
语法错误,动态SQL不需要冒号,要注意你的引号,另sqlca.sqlerrtext 为执行失败返回的错误信息
------解决方案--------------------
直接写成这样:
INSERT INTO two_ck_main (cDLCode,dDate,cChehao) VALUES(:s_cdlcode,:d_riqi,:s_chehao);