error when open MDB file in VB.NET

  • Thread starter Thread starter Daniel
  • Start date Start date
D

Daniel

Hi All,

I am trying to open mdb file from VB.NET. But I have got an error say
Unspecified error (-2147467259). Here is my code.

Imports System.IO
Imports system.Data.OleDb

.....

Dim ConnStr As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=C:\PrintQueue.mdb"
Dim oConn As New OleDbConnection(ConnStr)
If File.Exists("C:\PrintQueue.mdb") Then
oConn.Open()
End If

The error happens in oConn.Open()

Can anyone please give me some tips? What's the problem?

Cheers
Daniel
 
Hi All,

I am trying to open mdb file from VB.NET. But I have got an error say
Unspecified error (-2147467259). Here is my code.

Imports System.IO
Imports system.Data.OleDb

....

Dim ConnStr As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=C:\PrintQueue.mdb"
Dim oConn As New OleDbConnection(ConnStr)
If File.Exists("C:\PrintQueue.mdb") Then
  oConn.Open()
End If

The error happens in oConn.Open()

Can anyone please give me some tips? What's the problem?

Cheers
Daniel

Actually, the code is in web service. I am developing a console
application using web service to insert data in to Access database. I
can open mdb in console application but failed in web service. I am
thinking it is probably because the file path for web service is
different. I have tried several ways but no luck. Can anyone please
help?

Thanks
Daniel
 
Daniel said:
Actually, the code is in web service. I am developing a console
application using web service to insert data in to Access database. I
can open mdb in console application but failed in web service. I am
thinking it is probably because the file path for web service is
different. I have tried several ways but no luck. Can anyone please
help?

Thanks
Daniel


That helps diagnose it immensely. The web service runs under a
different account and does not have permission to open the mdb. Try
putting it in the web folders, such as App_Data. Another option, though
less appealing, is to impersonate a user that has permission to the
database from your web service.
 
Also note that there is no 64 bit oledb driver , so make sure the app is
compiled in only 32 bit modus and not with the anny cpu flag or 64 bit flag
in these cases your app wil crash with an error when run on a 64 bit
operating system .

a good alternative would be to ditch ACCESS and swith to SQL CE as this can
run without anny problems on a 64 bit os

HTH

Michel
 
Back
Top