<% Option Explicit %>
<%
On Error Resume Next
Dim Conn1
Set Conn1 = Server.Createobject("ADODB.Connection")
Conn1.Open "Driver={SQL Server};Server=localhost;Database=InfoTax;UID=administrator;PWD=rdpassword;"
If Err.Number <> 0 Then
Response.write("(SQL Server Driver) Database cannot connect Error = " & Err.Description&"<br>")
Else
Response.write("(SQL Server Driver) Database connected.<br>")
End If
Conn1.Close()
Set Conn1 = Nothing
Dim Conn2
Set Conn2 = Server.Createobject("ADODB.Connection")
Conn2.Open "InfoTax","administrator","rdpassword"
If Err.Number <> 0 Then
Response.write("(ODBC) Database cannot connect Error = " & Err.Description&"<br>")
Else
Response.write("(ODBC) Database connected.<br>")
End If
Conn2.Close()
Set Conn2 = Nothing
%>
ลอง Code ตามนี้ดูแล้วครับมันขึ้นมาว่า
Code
(SQL Server Driver) Database cannot connect Error = [Microsoft][ODBC SQL Server Driver][SQL Server]Login failed for user 'administrator'.
(ODBC) Database cannot connect Error = [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified