Main Page | Report this Page
.NET DotNet Forum Index  »  VB.NET Forum (Visual Basic .NET)  »  error when open MDB file in VB.NET...
Page 1 of 1    

error when open MDB file in VB.NET...

Author Message
Daniel...
Posted: Sun Oct 25, 2009 2:44 pm
Guest
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
 
Daniel...
Posted: Sun Oct 25, 2009 3:29 pm
Guest
On Oct 26, 11:44 am, Daniel <daniel.ran... at (no spam) gmail.com> wrote:
Quote:
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
 
Family Tree Mike...
Posted: Sun Oct 25, 2009 7:54 pm
Guest
Daniel wrote:
Quote:
On Oct 26, 11:44 am, Daniel <daniel.ran... at (no spam) gmail.com> wrote:
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


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.

--
Mike
 
 
Page 1 of 1    
All times are GMT - 5 Hours
The time now is Mon Dec 14, 2009 6:26 pm