Re: DSN Connection for Microsoft Access in ASP.NET by Sandeep
Sandeep
Fri May 18 10:07:21 CDT 2007
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
On May 18, 7:27 pm, Paul Clement
<UseAdddressAtEndofMess...@swspectrum.com> wrote:
> On 17 May 2007 21:45:54 -0700, Sandeep Gupta <sandy....@gmail.com> wrote:
>
> =A4 Hi,
> =A4
> =A4 I want to use aDSNconnectionto connect to MSAccessDatabase. The
> =A4 ODBCDSNhas been configured as MIT.
> =A4 I use the followingconnectionstring to connect (using VB.NET):
> =A4
> =A4 Dim cn As New OleDbConnection("Provider=3DMicrosoft.Jet.OLEDB.4.0;
> =A4DSN=3DMIT")
> =A4
> =A4 This throws up an error: Could not find installable ISAM
> =A4 [OleDbException (0x80004005): Could not find installable ISAM.]
> =A4 System.Data.OleDb.OleDbConnection.ProcessResults(Int32 hr) +20
> =A4 System.Data.OleDb.OleDbConnection.InitializeProvider() +57
> =A4 System.Data.OleDb.OleDbConnection.Open() +203
> =A4
> =A4 Can some one please let me know how to make aDSNconnectionto
> =A4MicrosoftAccess2000 database in ASP.NET 1.1?
>
> First, ODBC is not the recommend method for connecting to anAccessdatabas=
e=2E This method is not as
> stable and doesn't provide the level of functionality supported by Jet OL=
EDB.
>
> Second, It looks like you're trying to use theDSNwith the Jet OLEDB provi=
der. This is not
> supported. If you use aDSNthen you will probably need to use the ODBC lib=
rary instead of OLEDB.
>
> Dim ODBCConnection AsMicrosoft.Data.Odbc.OdbcConnection
>
> Dim ConnectionString As String =3D "DSN=3DMIT;"
>
> ODBCConnection =3D NewMicrosoft.Data.Odbc.OdbcConnection(Connecti=
onString)
> ODBCConnection.Open()
>
> Paul
> ~~~~MicrosoftMVP (Visual Basic)