Connection Problem with ADODB/Access DB

  • Thread starter Thread starter Mohana Santhanam
  • Start date Start date
M

Mohana Santhanam

Hello,

ASP gives me an unspecified error with the following code:

--------------------------------
<%Option Explicit %>
<HTML>
<HEAD>
<TITLE>Testing connection to the database</TITLE>
</HEAD>
<BODY>

<%
Dim strConnect
strConnect= "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=c:\datastores\Acme.mdb;" & _
"Persist Security Info=False"

Dim adOpenForwardOnly, adLockReadOnly, adCmdTable
adOpenForwardOnly = 0
adLockReadOnly = 1
adCmdTable = 2

Dim objConn, objRS
Set objConn = Server.CreateObject("ADODB.Connection")
Set objRS = Server.CreateObject("ADODB.Recordset")

objConn.Open strConnect

--------------------------------

ASP barfs on the 'objConn.Open strConnect' statement.
Can anyone see why? We have Windows XP Professional
running IIS 5.0. We have also installed .NET framework
v.1.1.

Thanks.
 
¤ Hello,
¤
¤ ASP gives me an unspecified error with the following code:
¤
¤ --------------------------------
¤ <%Option Explicit %>
¤ <HTML>
¤ <HEAD>
¤ <TITLE>Testing connection to the database</TITLE>
¤ </HEAD>
¤ <BODY>
¤
¤ <%
¤ Dim strConnect
¤ strConnect= "Provider=Microsoft.Jet.OLEDB.4.0;" & _
¤ "Data Source=c:\datastores\Acme.mdb;" & _
¤ "Persist Security Info=False"
¤
¤ Dim adOpenForwardOnly, adLockReadOnly, adCmdTable
¤ adOpenForwardOnly = 0
¤ adLockReadOnly = 1
¤ adCmdTable = 2
¤
¤ Dim objConn, objRS
¤ Set objConn = Server.CreateObject("ADODB.Connection")
¤ Set objRS = Server.CreateObject("ADODB.Recordset")
¤
¤ objConn.Open strConnect
¤
¤ --------------------------------
¤
¤ ASP barfs on the 'objConn.Open strConnect' statement.
¤ Can anyone see why? We have Windows XP Professional
¤ running IIS 5.0. We have also installed .NET framework
¤ v.1.1.

Without knowing what the actual error is it's difficult to determine what the problem is. However, I
would check out the following MS KB article to see if it applies:

PRB: Microsoft Access Database Connectivity Fails in Active Server Pages
http://support.microsoft.com/default.aspx?scid=kb;en-us;253604&Product=asp


Paul ~~~ (e-mail address removed)
Microsoft MVP (Visual Basic)
 
Back
Top