本文发表在 rolia.net 枫下论坛Below is the error that occured when I run ASP to access MS Access database through OBBC. PLease advise me how to fix it.Thanks.
Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80004005)
[Microsoft][ODBC Driver Manager] Driver's SQLSetConnectAttr failed
/data/readdata.asp, line 10
---ASP file---
<% @LANGUAGE = VBScript %>
<% ' Listing 13.1 Retrieving Product Data from the Northwind Database
Option Explicit
Response.Expires = 0
Dim objConn, objRS, strQuery
Dim strConnection
Set objConn = Server.CreateObject("ADODB.Connection")
'strConnection = "DSN=Northwind;Database=Nwind;"
'strConnection = strConnection & "UID=;PWD=;"
objConn.Open "Northwind"
strQuery = "SELECT Productname, UnitPrice FROM Products "
strQuery = strQuery & "ORDER BY Productname"
Set objRS = objConn.Execute(strQuery)
%>
<HTML>
<BODY>
All products stored in the Products table,
ordered by product name: <BR><BR>
<%
While Not objRS.EOF
Response.Write objRS("Productname") & " ("
Response.Write FormatCurrency(objRS("UnitPrice")) & ")<BR>"
objRS.MoveNext
Wend
objRS.close
objConn.close
Set objRS = Nothing
Set objConn = Nothing
%>
</BODY>
</HTML>更多精彩文章及讨论,请光临枫下论坛 rolia.net
Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80004005)
[Microsoft][ODBC Driver Manager] Driver's SQLSetConnectAttr failed
/data/readdata.asp, line 10
---ASP file---
<% @LANGUAGE = VBScript %>
<% ' Listing 13.1 Retrieving Product Data from the Northwind Database
Option Explicit
Response.Expires = 0
Dim objConn, objRS, strQuery
Dim strConnection
Set objConn = Server.CreateObject("ADODB.Connection")
'strConnection = "DSN=Northwind;Database=Nwind;"
'strConnection = strConnection & "UID=;PWD=;"
objConn.Open "Northwind"
strQuery = "SELECT Productname, UnitPrice FROM Products "
strQuery = strQuery & "ORDER BY Productname"
Set objRS = objConn.Execute(strQuery)
%>
<HTML>
<BODY>
All products stored in the Products table,
ordered by product name: <BR><BR>
<%
While Not objRS.EOF
Response.Write objRS("Productname") & " ("
Response.Write FormatCurrency(objRS("UnitPrice")) & ")<BR>"
objRS.MoveNext
Wend
objRS.close
objConn.close
Set objRS = Nothing
Set objConn = Nothing
%>
</BODY>
</HTML>更多精彩文章及讨论,请光临枫下论坛 rolia.net