ASP VBSCRIPT MS SQL SERVER连接

时间:2012-11-30 16:37:05

标签: sql-server asp-classic

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

这就是我在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'。出了什么问题?这是数据库连接的问题吗?

0 个答案:

没有答案