Datareader give “Unspecified Error ” after 64 database transaction(open /close Connection) With
Hello All
I am using MS-Access database and I use Data reader as closeconnection behvrior such like give belowe.
Con.Open();
Rdr = Cmd.ExecuteReader(CommandBehavior.CloseConnection);
When I have complete 64 transaction(connection Open/Close) with database It give error
Such like “Unspecified Error”
Please give any idea.
Thanks
Anup patel
Hello
Prafulkumar
Thank for Your Reply,
I have made MyExecuteReader() Method that is use in multiple place in code
So I have made given below Method
#region ExecuteReader
public OleDbDataReader MyExecuteReader(string Quary)
{
OleDbConnection Con = new OleDbConnection();
OleDbCommand Cmd = new OleDbCommand();
OleDbDataReader Rdr;
try
{
Con.ConnectionString = ConString;
Cmd.Connection = Con;
Cmd.CommandText = Quary;
if (Con.State == ConnectionState.Open)
{
Con.Close();
}
Con.Open();
Rdr = Cmd.ExecuteReader(CommandBehavior.CloseConnection);
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
MessageBox.Show(ex.Message.ToString());
Rdr = null;
LogInfo(ex.Message.ToString(), Quary);
}
finally
{
Cmd.Dispose();
}
return Rdr;
}
#endregion
I does not want to use give below , it is not usefull for all Quary ,So pleasegive Idea of My Problem
“ Datareader give “Unspecified Error ” after 64 database transaction(open /close Connection) With MS-Access database”
Con.Open();
Rdr = Cmd.ExecuteReader();
Con.Close();