asp 中语句未结束,是怎么回事。

来源:百度知道 编辑:UC知道 时间:2024/05/28 18:39:07
错误提示为:
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>

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是数字型,因此用一楼的说法就可以了~~而不用加'