?
Solved

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

Posted on 2005-04-12
3
Medium Priority
?
1,763 Views
Last Modified: 2008-01-09
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?
0
Comment
Question by:hagitsh
3 Comments
 
LVL 1

Expert Comment

by:vaibhavheera
ID: 13760067
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
 
LVL 1

Accepted Solution

by:
karlossos earned 1000 total points
ID: 13760794

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
 
LVL 4

Expert Comment

by:darkpriest
ID: 13760836
Or you could try using a previous version of JET i use SQL server personally.
0

Featured Post

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In real business world data are crucial and sometimes data are shared among different information systems. Hence, an agreeable file transfer protocol need to be established.
If you are a mobile app developer and especially develop hybrid mobile apps then these 4 mistakes you must avoid for hybrid app development to be the more genuine app developer.
Progress
Screencast - Getting to Know the Pipeline

862 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question