473,387 Members | 1,463 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,387 software developers and data experts.

oleDbConnection.open problem

I need to call oleDbConnection.open concurrently in several class or in the same class
but there is an exception
System.InvalidOperationException occurred in system.data.dll
Additional information: The connection is already open (state=open)
************************************************** ********************
Sent via Fuzzy Software @ http://www.fuzzysoftware.com/
Comprehensive, categorised, searchable collection of links to ASP & ASP.NET resources...
Nov 21 '05 #1
2 1715
Juicy,

In an application you can only use one open connection in a time in Net 1.x

Solution, just do it as recomended create and dispose it every time that it
is needed.
(Although this is a recommendation for when there are simultane more than
100 connections)

I hope this helps?

Cor
Nov 21 '05 #2
Hey Juicy,

Another way around this is to declare a public connection, maybe creating a
seperate DB class for your database connection handling. Then make sure that
all forms and classes are using your: newdbclass.connDB. The disadvantage to
this is not being able to use the visual designer to set the connection
property of dbcommands. you must do this manually in code.

Typically I do it this way to ensure there is only one instance of the
connection and the state is definate. Other benefits also include a way of
getting the connection statechange event for the entire application. This
comes in handy for statusbars. as you know that when the status changes in
this public connection there is something happening.

Regards,

Michael Proctor

"juicy" <ju***@hotmail.com> wrote in message
news:%2***************@TK2MSFTNGP15.phx.gbl...
I need to call oleDbConnection.open concurrently in several class or in the
same class
but there is an exception
System.InvalidOperationException occurred in system.data.dll
Additional information: The connection is already open (state=open)
************************************************** ********************
Sent via Fuzzy Software @ http://www.fuzzysoftware.com/
Comprehensive, categorised, searchable collection of links to ASP &
ASP.NET resources...

Nov 21 '05 #3

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

Similar topics

1
by: Matthias Kwiedor | last post by:
Hello! My Application is Multi-Threaded, where i have several threads which get datas and write them to the database, or have to read from the database to compare the datas and make updates if...
2
by: Grant | last post by:
My C# web application connects to an Access database using the OleDbConnection and OleDbDataReader. I have 3 other computers that connect to this server but very frequently I get an 'Unspecified...
1
by: Keith | last post by:
Hi, if have this method in a cs file that connections to a database and returns a datareader to my web form. public OleDbDataReader GetDataReader(string theSQL) { theConn = new...
3
by: Ludvig | last post by:
This Exception is executed when using SQLConnection. OleDbConnection connects fine. System.EnterpriseServices.Platform.Initialize() +503...
2
by: Marcel Hug | last post by:
Hello NG ! I would like to open a MS Access Db by C#. I use the following code: string strConnectionText = @"Provider=Microsoft.Jet.OLEDB.4.0; Data...
1
by: Souloron | last post by:
Here what I did: string cmdText = String.Format(("CREATE TABLE {0} (dno int primary key, Sunday char(5), Monday char(5), Tuesday char(5), Wednesday char(5), Thursday char(5),...
7
by: Miro | last post by:
I think i have found my problem following an example ive searched for on the net. I am using vb.net 2005 express. What I am looking for is a drag drop from the toolbar that is an...
4
by: tamarindm | last post by:
I am using the following to connect to a Sybase server. OleDbConnection Conn= new OleDbConnection(); string connstr = "Provider=Sybase ASE OLE DB Provider;Data Source=SERVER;User...
1
by: Mel | last post by:
I am performing the same recordset multiple times, just passing different parameters each time. Is there a way to do this more efficiently without having to close and re-open the connection and...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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...
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,...

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.