深圳蓝胖子机器人:ASP 连接 access 问题相关!

来源:百度文库 编辑:高校问答 时间:2024/04/29 17:38:03
这是一个检查用户和密码的动态页面,但是不知道为什么,数据库建立了是ACCESS MDB的,就是连不上?不知道是不是要设置ODBC什么的,还有连接池,数据库服务如何建立啊!

<% Option Explicit %>
<!--#include file="common.inc" -->
<!--#include file="md5.asp"-->
<%
Dim rsCheckUser 'Database Recordset Variable
Dim strUserName 'Holds the user name
Dim strUserPassword 'Holds the user password

'Initalise the strUserName variable
strUserName = Request.Form("txtUserName")

'Create recorset object
Set rsCheckUser = Server.CreateObject("ADODB.Recordset")

'Initalise the strSQL variable with an SQL statement to query the database
strSQL = "SELECT MB_Config.Password, MB_Config.Username "
strSQL = strSQL & "FROM MB_Config "
strSQL = strSQL & "WHERE MB_Config.Username ='" & strUserName & "'"

'Query the database
rsCheckUser.Open strSQL, strCon

'If the recordset finds a record for the username entered then read in the password for the user
If NOT rsCheckUser.EOF Then
'Read in the password for the user from the database
If md5(Request.Form("txtUserPass")) = rsCheckUser("Password") Then

'If the password is correct then set the session variable to True
Session("blnIsUserGood") = True

'Close Objects before redirecting
Set rsCheckUser = Nothing
Set strCon = Nothing
Set adoCon = Nothing

'Redirect to the admin menu page
Response.Redirect"admin_menu.asp"
End If
End If

'Reset server objects
Set rsCheckUser = Nothing
Set strCon = Nothing
Set adoCon = Nothing

'If the script is still running then the user must not be authorised
Session("blnIsUserGood") = False

'Redirect to the unautorised user page
Response.Redirect"unauthorised_user_page.htm"
%>
最好是手把手教会设置的那种,要改程序的话!说明错误,编程就我来!
呵呵没有办法啊?反正是调试,以后改!我就连不明白!想问问高手!
conn.inc是系统配置文件

common.inc是连接数据库的代码吧???错误在连接数据库的代码里。你发的这些都没问题

你连接数据库的代码贴出来啊。

你的数据库连接都没有1