By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
448,952 Members | 1,055 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 448,952 IT Pros & Developers. It's quick & easy.

Executereader requires an open and available connection

P: 15
I m getting an error "System.InvalidOperationException - Executereader requires an open and available connection"
I have Open an Connection, but still it throughs an Error. But it occurs Sometimes..

Following is the code,
Expand|Select|Wrap|Line Numbers
  3.  if (con == null)
  4.      con = new OleDbConnection("" + StrConnection);
  6.  if (con.State == ConnectionState.Closed)
  7.      con.Open();
  8.    OleDbCommand cmd = new OleDbCommand("Select (Max(BOMId)+1) as BOMNo from BOM ", con);
  9.   OleDbDataReader dr = cmd.ExecuteReader(); // error occurs at this Line  
  10.      while (dr.Read())
  11.        {
  12.           ----

What Could be the problem??
Sep 28 '10 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.