I run the following code
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 place a debugger from the first statement of a try block and find that an error occurs when I try to open a connection. Error text:
Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done.
Connection string:
"Provider = Microsoft.Jet.OLEDB.4.0; DataSource = E: \ NewSoft \ Database \ TestApp.accdb Integrated Security = SSPI"
I am using oledb connections.
source
share