在一次ASP程序中不能正常連接MSSQL出現出錯信息如下:
HTTP/1.1 200 OK Server: Microsoft-IIS/5.1 Date: Sun, 11 Jun 2006 00:59:27 GMT Connection: close Content-Length: 65 Content-Type: text/Html Cache-control: private
HTTP/1.1 401 錯誤: 拒絕訪問。
程序源文件:
<%
dim SqlLocalName,SqlUsername,SqlPassWord,SqlDatabaseName,Conn,ConnStr,db,Err_OpenDatabase
SqlLocalName ="(local)" '連接IP [ 本地用 (local) 外地用IP ]
SqlUsername ="sa" '用戶名
SqlPassWord ="zhengque" '用戶密碼
SqlDatabaseName="vnut" '數據庫名
Set conn = Server.CreateObject("ADODB.Connection")
connstr = "Provider=Sqloledb; User ID=" & SqlUsername & "; Password=" & SqlPassWord & "; Initial Catalog = " & SqlDatabaseName & "; Data Source=" & SqlLocalName & ";"
conn.Open connstr
sub CloseConn()
On Error Resume Next
Conn.close
set Conn=nothing
end sub
%>
原因是:
要不就是
你的sa密碼不對
要不就是你的MySQL沒啟動