Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done

Tags:

c#

.net

oledb

I am running following code

/*Fetchinch Last CustID from custMaster*/
int ID = 0;
try
{
     con.Open();
     da = new OleDbDataAdapter("select max(Id) from custMaster",con);
     DataSet ds = new DataSet();
     da.Fill(ds);
     for(int i=0;i<ds.Tables[0].Rows.Count;i++)
        ID=int.Parse(ds.Tables[0].Rows[i][0].ToString());
     con.Close();
}
catch (Exception ex) {}
finally 
{
     con.Close();
}

I am putting debugger from the first statement of try block and finding that error is coming when I am trying to open the connection. Error Text:

Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done.

Connection String is:

"Provider=Microsoft.Jet.OLEDB.4.0;DataSource=E:\NewSoft\Database\TestApp.accdb;Integrated Security=SSPI"

I am using oledb connections.

like image 435
Freelancer Avatar asked Feb 28 '13 07:02

Freelancer


People also ask

What is an OLE DB error?

OLE DB error: OLE DB or ODBC error: A network-related or instance-specific error has occurred while establishing a connection to SQL Server. Server is not found or not accessible. Check if instance name is correct and if SQL Server is configured to allow remote connections.

What is OLE DB used for?

Object Linking and Embedding Database (OLE DB) is a group of APIs used to facilitate and abtract access to application data of different file formats, including spreadsheets, structured query language (SQL)-based database management systems (DBMS), indexed-sequential files, and personal databases.

Is OLE DB an API?

OLE DB (Object Linking and Embedding, Database, sometimes written as OLEDB or OLE-DB), an API designed by Microsoft, allows accessing data from a variety of sources in a uniform manner.


3 Answers

I had a similar issue when opening a connection with the following connection string:

Data Source=.\SQLEXPRESS;Initial Catalog=master;Integrated Security=True

Changing Integrated Security=True to Integrated Security=SSPI in the connection string fixed the problem.

like image 78
Kirtlander Avatar answered Sep 23 '22 08:09

Kirtlander


This can be the result of the error in your connection string. You should try to add

Persist Security Info=True;

Or you might have problems in your registry with your OLE DB provider, which must have OLEDB_SERVICES record. In the registry under HKEY_CLASSES_ROOT\CLSID, find the CLSID of the OLE DB provider and add the following registry value:

Value Name: OLEDB_SERVICES
Data Type: REG_DWORD
Value: 0xFFFFFFFF

See http://support.microsoft.com/kb/269495 for more information

like image 31
Alex Avatar answered Sep 23 '22 08:09

Alex


For a similar problem connecting to a MS Access database, this exact error was generated for a wrong password set in the connection attribute of Jet OLEDB:Database Password=

like image 22
zak Avatar answered Sep 24 '22 08:09

zak