DSN Connection for Microsoft Access in ASP.NET

  • Thread starter Thread starter Sandeep Gupta
  • Start date Start date
S

Sandeep Gupta

Hi,

I want to use a DSN connection to connect to MS Access Database. The
ODBC DSN has been configured as MIT.
I use the following connection string to connect (using VB.NET):

Dim cn As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;
DSN=MIT")

This throws up an error: Could not find installable ISAM
[OleDbException (0x80004005): Could not find installable ISAM.]
System.Data.OleDb.OleDbConnection.ProcessResults(Int32 hr) +20
System.Data.OleDb.OleDbConnection.InitializeProvider() +57
System.Data.OleDb.OleDbConnection.Open() +203

Can some one please let me know how to make a DSN connection to
Microsoft Access 2000 database in ASP.NET 1.1?

Thanks in advance,
Sandeep Gupta
 
¤ Hi,
¤
¤ I want to use a DSN connection to connect to MS Access Database. The
¤ ODBC DSN has been configured as MIT.
¤ I use the following connection string to connect (using VB.NET):
¤
¤ Dim cn As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;
¤ DSN=MIT")
¤
¤ This throws up an error: Could not find installable ISAM
¤ [OleDbException (0x80004005): Could not find installable ISAM.]
¤ System.Data.OleDb.OleDbConnection.ProcessResults(Int32 hr) +20
¤ System.Data.OleDb.OleDbConnection.InitializeProvider() +57
¤ System.Data.OleDb.OleDbConnection.Open() +203
¤
¤ Can some one please let me know how to make a DSN connection to
¤ Microsoft Access 2000 database in ASP.NET 1.1?

First, ODBC is not the recommend method for connecting to an Access database. This method is not as
stable and doesn't provide the level of functionality supported by Jet OLEDB.

Second, It looks like you're trying to use the DSN with the Jet OLEDB provider. This is not
supported. If you use a DSN then you will probably need to use the ODBC library instead of OLEDB.

Dim ODBCConnection As Microsoft.Data.Odbc.OdbcConnection

Dim ConnectionString As String = "DSN=MIT;"

ODBCConnection = New Microsoft.Data.Odbc.OdbcConnection(ConnectionString)
ODBCConnection.Open()


Paul
~~~~
Microsoft MVP (Visual Basic)
 
Thanks a lot Paul, I was able to connect to the database using your
suggestions.

One more query,

When I am using the Jet OLEDB provider and specifying the physical
path using the Server.MapPath(".")+"/Data/MIT.db", I get the error
saying the file "d:\host\mit\www\data\mit.db" could not be found. But
the location of the uploaded file is www\data\mit.db.

Is there any workaround to get access using the Jet driver?

- Sandeep
 
¤ Thanks a lot Paul, I was able to connect to the database using your
¤ suggestions.
¤
¤ One more query,
¤
¤ When I am using the Jet OLEDB provider and specifying the physical
¤ path using the Server.MapPath(".")+"/Data/MIT.db", I get the error
¤ saying the file "d:\host\mit\www\data\mit.db" could not be found. But
¤ the location of the uploaded file is www\data\mit.db.
¤
¤ Is there any workaround to get access using the Jet driver?

Could you post your code?

I can't tell where your Data folder is relative to your application path.


Paul
~~~~
Microsoft MVP (Visual Basic)
 
Hi Paul,

I am using the following code:

Dim conn as String = ""Provider=Microsoft.Jet.OLEDB.4.0; DataSource="
+ Server.MapPath(".") + "\Data\MIT.db"
Dim cn As New OleDbConnection(conn)

Now the Server.MapPath(".") returns d:\host\mit\www, but while
connecting it says the path cannot be found.

Thanks,
Sandeep
 
¤ Hi Paul,
¤
¤ I am using the following code:
¤
¤ Dim conn as String = ""Provider=Microsoft.Jet.OLEDB.4.0; DataSource="
¤ + Server.MapPath(".") + "\Data\MIT.db"
¤ Dim cn As New OleDbConnection(conn)
¤
¤ Now the Server.MapPath(".") returns d:\host\mit\www, but while
¤ connecting it says the path cannot be found.
¤

If the path is valid could this be a permissions issue? What type of authentication is your web
application configured for? Anonymous? Basic? Integrated Windows?


Paul
~~~~
Microsoft MVP (Visual Basic)
 
Back
Top