狮子会冬装:谁可以帮我判断一下!定位数据的输入代码

来源:百度文库 编辑:中科新闻网 时间:2024/05/07 08:40:36
网址:xxxxxxsxxx.asp?id=123

<%
ID=request.querystring("ID")
set rs = server.CreateObject("adodb.recordset")
sql="select * from user where ID='" & cint(id) & "'"
rs.open sql,connstr,1,1
if not rs.eof then
%><%=("id")%> '数据库中的字段假设是1 但不能显示出来..
<%end if%>

<%
id=request("id")
sql="select * from 12_user where id=cint('"&id&"')"
set rs=conn.execute(sql)
if rs.eof then
response.redirect "wrong.htm"
end if
%>
<%=("id")%> .1可以显示出来.

1:

ID='" & cint(id) & "'"

2:

ID=cint('"&id&"')"

程序中的1和2有什么区别..我用上传的那个就会出错.用下面的就没问题...但在其它程序上又是可以的..这是什么回事..到底那个好用点..??1的代码~~是不是有问题呢?..还是格式不对..请指点...小弟在些谢过了.

sql="select * from user where ID='" & cint(id) & "'"
上面是正确的。
最好写成:
sql="select * from user where ID='" & id & "'"
-----------------------
sql="select * from 12_user where id=cint('"&id&"')"
是错误的。
因为sql语句里面没有cint函数啊。
---------------------
<%=("id")%> 输出的是字符串“id”,而不是变量id的值。