菜鸟问题,我什么时候才能不问菜鸟问题呢-----????
我的global.asa文件:建立了一个全局变量dsn。
</SCRIPT>
<SCRIPT LANGUAGE=VBScript RUNAT=Server>
Sub Application_OnStart
Application("dsn") = "DSN=newbookware;UID=;PWD=;"
End Sub
</SCRIPT>
这是我的登录文件default.asp.
<%
Response.Expires = 0
session.Abandon
%>
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<style>
BODY
{
FONT-FAMILY: 宋体;
FONT-SIZE: 14px;
LINE-HEIGHT: 20px
}
CENTER
{
FONT-FAMILY: 宋体;
FONT-SIZE: 15px;
}
input
{
FONT-FAMILY: 宋体;
FONT-SIZE: 12px;
TEXT-DECORATION: none
}
select
{
FONT-FAMILY: 宋体;
FONT-SIZE: 12px;
TEXT-DECORATION: none
}
</style>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>电子书库系统</title>
</head>
<body BACKGROUND="images/back.gif" >
<center>
<br>
<br>
<p><h1><font face="隶书"> 电子书库系统</h1> <p>
<form action="logon.asp" method="POST" id=form1 name=form1>
<table border="0" width="50%">
<tr>
<td align="right"><b><font FACE="楷体_GB2312">用户名:
<TD width="55%"><input type="text" size="20" name="name">
</tr>
<tr>
<td align="right"><b><font FACE="楷体_GB2312"><b><font FACE="楷体_GB2312">密 码:
<td><input type="password" size="20" name="passwd">
</tr>
<tr>
<td align="center" colspan="2"><p><input
type="submit" name="OK" value="登 录">
<input type=reset name=cancel value="重 填"></p>
</tr>
</table>
</form>
</center>
</body>
</html>
这是我的检查登录信息文件logo.asp.
<%@ Language=VBScript %>
<%
name = Request.Form("name")
passwd = Request.Form("passwd")
//type是用户级别
sql = "select name,passwd,type from usertype where name ='" & name & "'"
set conn = server.CreateObject("adodb.connection")
conn.Open application("dsn")
set rs = server.CreateObject("adodb.recordset")
rs.Open sql,conn
//数据库中已有登录名及密码
if rs.EOF then
response.write "错误的用户名或密码!"
rs.Close
set rs = nothing
conn.Close
set conn = nothing
Response.End
end if
if not (rs("passwd") = passwd) then
response.write "错误的用户名或密码!"
rs.Close
set rs = nothing
conn.Close
set conn = nothing
Response.End
end if
session("username") = rs("name")
session("usertype") = rs("type")
rs.Close
set rs = nothing
sql = "update visit set visitnum = visitnum +1"
conn.Execute sql
conn.Close
set conn = nothing
Response.Redirect "frame.asp"
%>
出现错误:
术信息(适用于支持人员)
错误类型:
Microsoft OLE DB Provider for ODBC Drivers (0x80004005)
/logon.asp, 第 36 行
浏览器类型:
Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)
页:
POST 36 bytes to /logon.asp
POST 数据:
name=admin&passwd=1&OK=%B5%C7+%C2%BC
时间:
2003年11月23日, 12:12:05
详细信息:
Microsoft 支持
以上是程序及出错信息,请各位技术大侠帮忙看一下。
我用的是系统dsn。全都按书上教的一步不差的配置的。我用的是win2000 pro版Access 2002.WIN2000的系统登录名是Administrator和Guest。不知道究竟是全局变量dsn没有起作用,还是象我查的资料上说的,登录数据库时系统帐号错误。(后者我不太明白)还有我从书店看到一本<<ASP程序调试实用手册>>不知道此书对我这样的初者有帮助吗?有没有更好的书呢?