有变量的查询怎么写

dim xx
xx=request.querystring("rs_id")
Set rs = Server.CreateObject("ADODB.Recordset")
rs.Open "select * from table where ID='"&xx&"'",cn,1,1
ID是自动编号类型的,这个语句对吗?

---------------------------------------------------------------

rs.Open "select * from table where ID=" & xx ,cn,1,1
---------------------------------------------------------------

rs.Open "select * from table where ID="&Cint(xx),cn,1,1
---------------------------------------------------------------

rs.Open "select * from table where ID="&xx,cn,1,1

---------------------------------------------------------------

rs.Open "select * from table where ID="&Cint(xx)

cint()没必要,反正都是当字符串处理的
---------------------------------------------------------------

tt

Published At
Categories with Web编程
Tagged with
comments powered by Disqus