error when open MDB file in VB.NET


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
 
Ad

Advertisements

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

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
 
F

Family Tree Mike

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.
 
Ad

Advertisements

M

Michel Posseth [MCP]

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top