asp登陆问题,很着急啊,在线等...

来源:百度知道 编辑:UC知道 时间:2024/06/23 19:29:44
<!--#include file="conn.asp"-->
<%
dim user
dim pwd
dim typ
dim sql
dim rs
user=request("name")
pwd=request("pwd")
typ=request("zx")
sql="select * from login where username='"&user&"' and password='"&pwd&"' and usertype = '"&typ&"'"

set rs = conn.execute(sql)
if rs.eof or rs.bof then
%>
<script language="VBScript">
msgbox "对不起,没有此用户,请先注册。"
location.href="index.asp"
</script>
<% else
session.Timeout=30
if typ=1 then
loginnum=rs("loginnum")
sql="update login set lastlogin='"&now()&"' ,loginnum='"&loginnum+1&"' where id='"&rs("id")&"'"
conn.execute(sql)
session("boolean")=11
session("typ

在使用Access数据写SQL语句时,要特别注意数据类型问题:
若是数据库字段为字符型,则在SQL语句时需要在value两端加单引号(');
若是数据库字段为数字型,则在SQL语句时不需要在value两端添加任何字符;
若是数据库字段为日期型,则在SQL语句时需要在value两端添加井号(#);
准照上述原则检查你的SQL语句,这个问题便会迎刃而解。

检查传过来的三个值都是什么

" select * from login where username='"&user&"' and password='"&pwd&"' and usertype = '"&typ&"'"

如果usertype是int型,这样写保险一点usertype="&cint(typ)

个人觉得asp有时会出一些怪怪的毛病,我以前用c#.net的,转来用ASP不习惯

sql="select * from login where username='"&user&"' and password='"&pwd&"' and usertype = "&typ