473,395 Members | 1,701 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Executereader requires an open and available connection

Hello,
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
  1.  
  2.  
  3.  if (con == null)
  4.      con = new OleDbConnection("" + StrConnection);
  5.  
  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.           ----
  13.  

What Could be the problem??
Sep 28 '10 #1
0 1156

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

Similar topics

6
by: karim | last post by:
I have an asp.net page that stopped running properly giving the error below. The app uses a SQL Server 2000 on another server. Enterprise Manager and Query analyzer on the web server can connect to...
1
by: Paul | last post by:
Hi I posted this as new since was not sure older posts are responded to. Anyhow the problem is a connection being left open, and has only happended a few times. This is code that someone else...
3
by: jimb | last post by:
I'm just starting to learn asp.net. What I have is a registration form for a message board system. Basically, the user enters in their info and it's validated. So I have a custom validator check...
6
by: Mike | last post by:
We are intermitantly receiving this error on our website. ExecuteReader requires an open and available Connection. The connection's current state is connecting. Following is the code from the Load...
7
by: fniles | last post by:
I am using VB.Net 2003 and MS Access (connecting using OleDBConnection). I read using DataAdapter and DataSet, not DataReader. When many people try to access the database at the same time, I get...
4
by: Marine | last post by:
Hi, My project must connect to a Sql Server quite often to read/write datas. I am wondering : do i have to open the connection to the Sql Server at the beginning when the application loads, then...
2
by: Tony Johansson | last post by:
Hello! How does this connection pool function actually ? As I have been told is that when the connection is returned to the pool the connection to the database is still open. What you do is that...
2
by: TG | last post by:
Hi! Once again I have hit a brick wall here. I have a combobox in which the user types the server name and then clicks on button 'CONNECT' to populate the next combobox which contains all the...
1
by: webster5u | last post by:
Hi, who's has experience to open connection pool in Tomcat 5.5 using JNDI? I recently research on it, i found the how-to guideline provided from apache tomcat website. It seem like not really work...
7
by: praveenb000 | last post by:
i write code for sending mail to client's given email addresses. But Im getting following error message The SMTP server requires a secure connection or the client was not authenticated. The...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.