asp+vb sql where条件语句中有变量怎么写
代码如下:
title=rs("title")
set rs2=server.createobject("adodb.recordset")
sql="select * from book where title='文章标题' order by id desc"
以上的代码是可以正确查询的
现在我要把文章标题换成变量title,不知该怎么连接?
title='&title&' title=:title都试过了,不行,汗.....
求各位大侠指点我这个小菜鸟.
[解决办法]
title有'的话
title = Replace(title,"'","''")sql="select * from book where [title]='" & title & "' order by id desc"
[解决办法]
title=rs("title")
set rs2=server.createobject("adodb.recordset")
sql="select * from book where title='"&title&"' order by id desc"