473,569 Members | 2,756 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ExecuteReader error

I am using OLEDBDataReader to read from an Access database.

I have 4 data source where I get my data from, and each data source is in
its own thread.

When receiving data, if it is a new commodity I am need to read from the
database.

Since I can receive data from different data source at the same time, it is
possible that I read from the database at the same time.

During ExecuteReader sometimes I will get the error

"ExecuteRea der requires an open and available Connection. The connection's
current state is Open, Executing."

How can I fix this ?

This are my codes:

Dim dr As OleDb.OleDbData Reader

Dim cmd As New OleDb.OleDbComm and

sql = "select [Open],[High],[Low],[Last] from CommodityPrice where Commodity
= '" & sContract & "'"

With cmd

.Connection = g_ConnectionOLE

.CommandText = sql

Try

dr = .ExecuteReader( )

Catch ex As Exception

DBErr(bErr, bSuccess, ex, sCaller)

If bSuccess Then

cmd.Connection = g_ConnectionOLE

dr = cmd.ExecuteRead er()

End If

End Try

End With

Jul 10 '06 #1
1 4680
fniles,

Each thread needs to open its own connection, select its data from the
database, and then close the connection.

Kerry Moorman
"fniles" wrote:
I am using OLEDBDataReader to read from an Access database.

I have 4 data source where I get my data from, and each data source is in
its own thread.

When receiving data, if it is a new commodity I am need to read from the
database.

Since I can receive data from different data source at the same time, it is
possible that I read from the database at the same time.

During ExecuteReader sometimes I will get the error

"ExecuteRea der requires an open and available Connection. The connection's
current state is Open, Executing."

How can I fix this ?

This are my codes:

Dim dr As OleDb.OleDbData Reader

Dim cmd As New OleDb.OleDbComm and

sql = "select [Open],[High],[Low],[Last] from CommodityPrice where Commodity
= '" & sContract & "'"

With cmd

.Connection = g_ConnectionOLE

.CommandText = sql

Try

dr = .ExecuteReader( )

Catch ex As Exception

DBErr(bErr, bSuccess, ex, sCaller)

If bSuccess Then

cmd.Connection = g_ConnectionOLE

dr = cmd.ExecuteRead er()

End If

End Try

End With

Jul 10 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
8773
by: BuddyWork | last post by:
Does anyone know if there are any articles explaining how I could debug into SqlCommand.ExecuteReader so I can see why I am getting a particular error. thanks
0
1375
by: BuddyWork | last post by:
Hello, The problem is that when using SqlCommand.ExecuteReader and the SQL statement raises an error of severity of 16 then ExecuteReader throws an exception, when you use OdbcCommand.ExecuteReader the exception is not raised but when you call Read() method of the OdbcDataReader you then get the exception which is correct, basically...
6
4478
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 that sql server just fine and run queries. I rebooted the web server and made aspnet member of the admin group. I don't know why the error...
2
11584
by: MattB | last post by:
I'm trying to implement an example I found for displaying images stored in a SQL database. The example code looks like this (in page_load): Dim connstr As String = "Integrated Security=SSPI;Initial Catalog=Northwind;Data Source=SERVER\netsdk" Dim cnn As New SqlConnection(connstr) Dim cmd As New SqlCommand ("select * from images where id="...
1
3611
by: shahi | last post by:
Hi all, i have a sp that produce an error when execute by some special parameters. i write a program in vb.net that execute it, but i come accross a strange problem: when i execute the sp with EXECUTENONQUERY the error is raised, but if i use EXECUTEREADER, nothing happens(no error is shown). Can anybody help me?
7
1653
by: Alec MacLean | last post by:
Hi all, I'm trying to deploy an ASP.NET (1.1) app to our production webserver, but having problems with the DAAB (from Ent Lib June 2005). As you might guess, it works just fine and dandy on my dev PC (VS2003). The error I'm getting on the production server is: The type initializer for...
4
4047
by: phil | last post by:
Hi, With the code below, i get the error: ExecuteReader: Connection property has not been initialized. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details:...
2
17848
by: Martin Z | last post by:
I'm using the TableAdapterHelper to set the connection and transaction properties on all the commands of all my typed table adapters.... I've checked at the time of the error and all the commands have their Transaction property set. But I still get this error when I call... documentTA.Update(documentDS.Document); "ExecuteReader requires...
7
13531
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 the error "ExecuteReader requires an open and available Connection. The connection's current state is Open, Executing." I do not use ExecuteReader,...
0
7697
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7612
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8120
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7672
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6283
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
3640
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2113
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1212
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
937
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.