10
Update语句中的表名不能用参数代替吗
asp连接access数据库中
dim strSql, strSql2
strSql="Update 东方不败 Set Sfhwhy='Y' where name='"&hy&"'"
conn2.Execute(strSql)
上述语句中的表名是东方不败,我们直接写到了查询语句中,是可行的,但遗憾的是,用参数来替代就是不行
Dim km
km="东方不败"
dim strSql, strSql2
strSql="Update "& km & "Set Sfhwhy='Y' where name='"&hy&"'"
conn2.Execute(strSql)
把参数赋值给km后,这就不行了
dim strSql, strSql2
strSql="Update "& "东方不败" & "Set Sfhwhy='Y' where name='"&hy&"'"
conn2.Execute(strSql)
还是直接用字符串,只不过是以字符串连接的方式,也是不行,不明白是什么原因,请高手指点下哈
sddtlm8
2015/06/11 14:59- asp.net
- update
- dim
- 点赞
- 收藏
- 回答
满意答案