学习型 ASP/PHP/ASP.NET 主机 30元/年全能 ASP/PHP/ASP.NET 主机,支持月付专业 MSSQL 数据库空间,支持月付专业 MySQL 数据库空间,支持月付
发新话题
打印

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

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

问题如上:代码在下:
<%
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是文本

TOP

rs.open query,con
改成
rs.open query,con,1,1
从BFS(Breadth First Study)到DFS(Depth First Study)

严重鄙视一切把论坛当成作业生成器和人肉搜索引擎的人

TOP

大概是这里出了问题,
   query="select password from guest where admin="
   query=query&"'"&username&"'"

TOP

解决了...
没有最好只有更好

TOP

发新话题