注册 登录
编程论坛 ASP技术论坛

[Microsoft][ODBC Microsoft Access Driver] 标准表达式中数据类型不匹配

zacom 发布于 2008-05-04 22:58, 954 次点击
问题如上:代码在下:
<%
cont="driver={microsoft access driver (*.mdb)};dbq= " & server.mappath("login.mdb")
set con=server.createobject("adodb.connection")
con.open cont
set rs=server.createobject("adodb.recordset")
action=trim(request("action"))
username=trim(request("username"))
password=trim(request("password"))
if action="action" then check=true
if len(username)<1 then check=false
if len(password)<1 then check=false
if check then
   query="select password from guest where admin="
   query=query&username&""
   rs.open query,con
   if(not rs.eof) then
      if(rs("password")=password) then
             check=true
      else
             check=false
      end if
   else
     check=false
   end if
   if check  then
     response.wirte "登陆成功"
   else
     response.write "登陆失败"
   end if
else
%>
  <html>
  <head>
  </head>
  <body>
  <body>
  <form action="1.asp" method="post">
  <input type="hidden" name="action" value="action">
  <table width="200" border="1">
  <tr>
    <th width="65" scope="row">用户名:</th>
    <td colspan="2"><label>
      <input name="username" type="text" size="5">
    </label></td>
  </tr>
  <tr>
    <th scope="row">登陆:</th>
    <td colspan="2"><label>
      <input name="password" type="text" size="5">
    </label></td>
  </tr>
  <tr>
    <th scope="row"><label>
      <input type="submit" name="Submit" value="登陆">
    </label></th>
    <td width="53"><label>
      <input type="submit" name="Submit2" value="取消">
    </label></td>
    <td width="60"><label>
      <input type="submit" name="Submit3" value="注册">
    </label></td>
  </tr>
  </table>
  </body>
  </html>
<% end if%>
其中admin,password是文本
3 回复
#2
永夜的极光2008-05-05 09:28
rs.open query,con
改成
rs.open query,con,1,1
#3
makebest2008-05-05 10:27
大概是这里出了问题,
   query="select password from guest where admin="
   query=query&"'"&username&"'"
#4
zacom2008-05-05 16:52
解决了...
1