asp登陆问题,请高手帮忙..急急急

来源:百度知道 编辑:UC知道 时间:2024/05/10 17:43:50
<!--#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(&q

<%set adocon=Server.CreateObject("ADODB.Connection")
filePath=Server.MapPath("../database/11111.mdb")
adocon.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="&filePath%>

access连接语句放在conn.asp中

除此之外,
username='"&user&"' and password='"&pwd&"' and usertype = '"&typ&"'
其中username,password,usertype 三个变量是不是都是字符型,如果不是,单引号就不要了~~~比如:usertype = "&typ&"

数字类型不要加单引号,只有字符型才加~~~。你检查检查吧。

老大,SQL数据库的连接方式和ACCESS数据库的连接方式是不一样的。。。。

ACCSEE连接方式

Conn= "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & dbPath & "SunPlan.mdb"

里面dbPath 是你的数据库路径,SunPlan.mdb就是你的数据库名称。

修改你的CONN。ASP文件,首先把里面连接SQLSERVER的语句注释掉,然后把上面那句加上。应该就OK了,如果还有问题加我QQ3516565