asp.net : OleDbException (0x80004005): Unspecified error

I am trying to connect to an access database
with an asp.net application
 
here is the code (vb.net):

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim sConStr, sSql, DelSql, InsSql, UpSql As String
        sConStr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\backup\temp\pinkas_be.mdb;Persist Security Info=False"
        sSql = "Select * from area_table order by area_name"

        Dim objConn As New OleDb.OleDbConnection(sConStr)
        Dim objDataAdapter As New OleDb.OleDbDataAdapter(sSql, objConn)
        Dim objDs As New DataSet
        objConn.Open()
        objDataAdapter.Fill(objDs)
        DataGrid1.DataSource = objDs
        DataGrid1.DataBind()
        objConn.Close()
    End Sub
 
the exception occurs in the objConn.Open() line:
OleDbException (0x80004005): Unspecified error

what could be the problem?
hagitshAsked:
Who is Participating?
 
karlossosConnect With a Mentor Commented:

OleDbException (0x80004005): Unspecified error

this is usually a permission problem.
change your connection string to:-

sConStr = "Provider=Microsoft.Jet.OLEDB.4.0;data source=C:\backup\temp\pinkas_be.mdb" '<- that's all you need
and ensure that IUSR_[compname] user account has access to the database as this is the user IIS will be using to poll the DB.

cheers,
Karl
0
 
vaibhavheeraCommented:
Do the following:

Put the code in try catch block.
Try to to assign command and connection to adapter in step by step
not in a single step which u have done in this code
and then debug the function line by line
U will be able to find the error

if the above steps not able to solve the problem

The error could be the version of jet provider u r using.
Try to use the latest version of provider.

Happy coding
Vai
0
 
darkpriestCommented:
Or you could try using a previous version of JET i use SQL server personally.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.