有兼职在家里做的工作:asp 中语句未结束,是怎么回事。

来源:百度文库 编辑:高考问答 时间:2024/05/05 20:21:42
错误提示为:
Microsoft VBScript 编译器错误 (0x800A0401)
语句未结束
/g888g0212/5.asp, line 11, column 65
exec="select * from dest2 where pw_ID="&CInt(request("Username"))""

全部代码为:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
</head>

<body>
<%
set conn=server.createobject("adodb.connection")
conn.open "driver={microsoft access driver (*.mdb)};dbq="&server.mappath("db1.mdb")
exec="select * from dest2 where pw_ID="&request.form("Username")""
set rs=server.createobject("adodb.recordset")
rs.open exec,conn,1,1
%>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<%
do while not rs.eof
%><tr>
<td><%=rs("pw_ID")%></td>
<td><%=rs("Username")%></td>
<td><%=rs("Password")%></td>
</tr>
<%
rs.movenext
loop
%>
</table>
</body>
</html>
Aleaf_com 你好,我按你说的改了,但是新的问题又来了,:参数类型不正确,或不在可以接受的范围之内,或与其他参数冲突。
/g888g0212/5.asp, 第 13 行
这又是怎么回事呢?
我的ID确实是数据型的。

exec="select * from dest2 where pw_ID="&request.form("Username")""

这句去掉后面的两个双引号.写成:
exec="select * from dest2 where pw_ID="&request.form("Username")

就OK啦.

是这句有问题,不过应该改成这样才对吧

exec="select * from dest2 where pw_ID='"&request.form("Username")&"'"

两种说法都对,关键要看你的ID字段是字符型,还是数字型
根据你的程序你用CINT()把REQUEST的数据变成了数字型,因此可以判断你的ID是数字型,因此用一楼的说法就可以了~~而不用加'