与openrecordset有关
运行以下代码,提示错误:事实错误'3061'
参数不足,期待是1
......
strrecord=combo1.text
'combo1.text显示customerid,customerid是整形
Set rstproduct = mybusiness.OpenRecordset _
("select firstname+lastname as name,productsname, _
produtamount,orderdate,offerdate from customers,orders _
where customers.customerid=orders.customerid _
and orders.customerid="+strrecord, dbOpenDynaset)
错误应该是在... orders.customerid="+strrecord
我试了许多办法也不行,请告诉我该怎麽该,谢谢.
问题点数:91、回复次数:5Top
1 楼lty(傻猫)回复于 2000-08-06 15:52:00 得分 0
看来你的strrecord是个字串,有两点:
1。不要用+号连接字符串,一定要用&。
2。SQL串内的字符变量一定要有'号。
你的最后应改为:
"........orders.customerid='" & strrecord & "'"
比如strrecord="56",最后的效果应为:
"........orders.customerid='56'"
Top
2 楼vicsue(victor)回复于 2000-08-06 23:10:00 得分 0
lty误解了,由于customerid是integer,所以无需用'号,只需改为:
"........orders.customerid=" & strrecord
Top
3 楼strangecat()回复于 2000-08-07 08:15:00 得分 0
1.用&代替+
2.仔细看看各列的名称写对了没有!!Top
4 楼bing71(softkitty)回复于 2000-08-07 09:02:00 得分 0
错在orders.customerid="+strrecord,应写为"orders.customerid='" & strrecord & "'"Top
5 楼Tyro(新手)回复于 2000-08-07 16:48:00 得分 91
你可以调试一下呀!看看你的程序中
"select firstname+lastname as name,productsname, _
produtamount,orderdate,offerdate from customers,orders _
where customers.customerid=orders.customerid _
and orders.customerid="+strrecord
到底是个什么东西,如果结果和你设想的一样,看看直接在数据库中用这个sql语句查询会出什么结果,如果还有错,就是你的sql语句写错了Top




