0

如何修复数据库连接?我正在将网站从一台服务器移动到另一台服务器。

这是我在 Connections 文件中得到的:

<%
' FileName="Connection_odbc_conn_dsn.htm"
' Type="ADO" 
' DesigntimeType="ADO"
' HTTP="true"
' Catalog=""
' Schema=""
Dim MM_**_STRING
MM_**_STRING = "Driver={SQL Server};Server=localhost;Database=mssql0_***_1;Uid=mssql0_***_1;Pwd=********;"
%>

这是asp文件:

<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!--#include virtual="/Connections/**.asp" -->
<%
' *** Validate request to log in to this site.
MM_LoginAction = Request.ServerVariables("URL")
If Request.QueryString <> "" Then MM_LoginAction = MM_LoginAction + "?" + Server.HTMLEncode(Request.QueryString)
MM_valUsername = CStr(Request.Form("userName"))
If MM_valUsername <> "" Then
    Dim MM_fldUserAuthorization
    Dim MM_redirectLoginSuccess
    Dim MM_redirectLoginFailed
    Dim MM_loginSQL
    Dim MM_rsUser
    Dim MM_rsUser_cmd

    MM_fldUserAuthorization = "userAccess"
    MM_redirectLoginSuccess = "/welcome.asp"
    MM_redirectLoginFailed = "/index.asp?error=Incorrect+Login,+Please+try+again"

    MM_loginSQL = "SELECT userName, userPassword, userFirstName"
    If MM_fldUserAuthorization <> "" Then MM_loginSQL = MM_loginSQL & "," & MM_fldUserAuthorization
    MM_loginSQL = MM_loginSQL & " FROM users WHERE userName = ? AND userPassword = ?"
    Set MM_rsUser_cmd = Server.CreateObject ("ADODB.Command")
    MM_rsUser_cmd.ActiveConnection = MM_**_STRING
    MM_rsUser_cmd.CommandText = MM_loginSQL

我在第 24 行出现错误“80004005”。出了什么问题?是不是数据库连接有问题?

4

0 回答 0