我做的是一个用户登入身份验证程序,但是当用户名输入是字母是就出现--列名(我输入的用户名)无效,输入数字则一切正常,写的代码如下,帮看下.
<%
'dim strUserName,strPassword,strConn,strSql
strUserName=trim(request("username"))
strPassword=trim(request("password"))
if strusername="" then
response.write"<body><p><center>用户名不能为空</center></p></body>"
Response.End
end if
set conn=server.CreateObject("ADODB.Connection")
strConn="Provider=SQLOLEDB;data source=(local);initial catalog=student;user id=sa;password=;"
conn.connectionstring=strConn
conn.open
strSql="select * from login where password="&trim(strpassword)&" and username="&trim(strusername)&" "
set rs=server.CreateObject("ADODB.RecordSet")
rs.open strsql,conn,1,3
if not rs.EOF then
Response.Write "<center>通过验证</center>"
else
Response.Write "<center>密码错误或不存在该用户</center>"
end if
%>
</BODY>
</HTML>
我写那段绿色的代码应该没错误把?我的数据表设置只有两个属性便是username和password,都是文本型,没设置索引和KERWORD,谢谢大虾帮忙......