Hi
I have a vb.net app that opens an access database runs several sql action
queries on the tables and closes the db. This is done every few minutes. The
problem is that sometimes I get an error 'ExecuteNonQuer y requires an open
and available Connection. The connection's current state is closed'. My
question is; is there a situation where an app automatically closes the db
connection causing this error and is there a way to prevent this?
Thanks
Regards 6 2244
On May 3, 11:55 am, "John" <J...@nospam.in fovis.co.ukwrot e:
Hi
I have a vb.net app that opens an access database runs several sql action
queries on the tables and closes the db. This is done every few minutes. The
problem is that sometimes I get an error 'ExecuteNonQuer y requires an open
and available Connection. The connection's current state is closed'. My
question is; is there a situation where an app automatically closes the db
connection causing this error and is there a way to prevent this?
Thanks
Regards
I'm guessing you are trying to use a global connection object right?
If so, change the code to open a connection to the database, execute
your commands, and then close/dispose of the command and connection.
You should try to avoid using a "global" connection object at all
costs as it can lead to serious problems (with very few benefits). If
I guessed wrong, please post your code so I can take a look.
Thanks,
Seth Rowe
Hi Seth
It is true that I am opening a global connection. Executing only some of sql
queries will cause problem with the integrity of the data in the database.
By using a global connection I was hoping to provide a guaranteed connection
to all queries reducing any expected problems. Is there a way to ensure that
all queries get executed or none?
Thanks
Regards
"rowe_newsgroup s" <ro********@yah oo.comwrote in message
news:11******** *************@l 77g2000hsb.goog legroups.com...
On May 3, 11:55 am, "John" <J...@nospam.in fovis.co.ukwrot e:
>Hi
I have a vb.net app that opens an access database runs several sql action queries on the tables and closes the db. This is done every few minutes. The problem is that sometimes I get an error 'ExecuteNonQuer y requires an open and available Connection. The connection's current state is closed'. My question is; is there a situation where an app automatically closes the db connection causing this error and is there a way to prevent this?
Thanks
Regards
I'm guessing you are trying to use a global connection object right?
If so, change the code to open a connection to the database, execute
your commands, and then close/dispose of the command and connection.
You should try to avoid using a "global" connection object at all
costs as it can lead to serious problems (with very few benefits). If
I guessed wrong, please post your code so I can take a look.
Thanks,
Seth Rowe
Is there a way to ensure that all queries get executed or none?
>
Follow the advice of Seth
Cor
"John" <Jo**@nospam.in fovis.co.ukschr eef in bericht
news:ua******** ******@TK2MSFTN GP05.phx.gbl...
Hi Seth
It is true that I am opening a global connection. Executing only some of
sql queries will cause problem with the integrity of the data in the
database. By using a global connection I was hoping to provide a
guaranteed connection to all queries reducing any expected problems. Is
there a way to ensure that all queries get executed or none?
Thanks
Regards
"rowe_newsgroup s" <ro********@yah oo.comwrote in message
news:11******** *************@l 77g2000hsb.goog legroups.com...
>On May 3, 11:55 am, "John" <J...@nospam.in fovis.co.ukwrot e:
>>Hi
I have a vb.net app that opens an access database runs several sql action queries on the tables and closes the db. This is done every few minutes. The problem is that sometimes I get an error 'ExecuteNonQuer y requires an open and available Connection. The connection's current state is closed'. My question is; is there a situation where an app automatically closes the db connection causing this error and is there a way to prevent this?
Thanks
Regards
I'm guessing you are trying to use a global connection object right?
If so, change the code to open a connection to the database, execute your commands, and then close/dispose of the command and connection. You should try to avoid using a "global" connection object at all costs as it can lead to serious problems (with very few benefits). If I guessed wrong, please post your code so I can take a look.
Thanks,
Seth Rowe
CORRECTION!
Seth is full of crap
Take your egocentric way of living and shove it up your ass
in ADO classic, we used to be able to open a connection; and close a
connection-- we used to be able to have multiple recordsets on the
same connection
now all we got is bloatware
We used to be able to run ADO commands FROM THE CLIENTSIDE OF THE WEB
BROWSER
this is no longer possible
screw ADO.net
\
On May 3, 9:46 am, rowe_newsgroups <rowe_em...@yah oo.comwrote:
On May 3, 11:55 am, "John" <J...@nospam.in fovis.co.ukwrot e:
Hi
I have a vb.net app that opens an access database runs several sql action
queries on the tables and closes the db. This is done every few minutes. The
problem is that sometimes I get an error 'ExecuteNonQuer y requires an open
and available Connection. The connection's current state is closed'. My
question is; is there a situation where an app automatically closes the db
connection causing this error and is there a way to prevent this?
Thanks
Regards
I'm guessing you are trying to use a global connection object right?
If so, change the code to open a connection to the database, execute
your commands, and then close/dispose of the command and connection.
You should try to avoid using a "global" connection object at all
costs as it can lead to serious problems (with very few benefits). If
I guessed wrong, please post your code so I can take a look.
Thanks,
Seth Rowe
Cor;
stfu and make microsoft fix the BUG
On May 3, 10:28 pm, "Cor Ligthert [MVP]" <notmyfirstn... @planet.nl>
wrote:
Is there a way to ensure that all queries get executed or none?
Follow the advice of Seth
Cor
"John" <J...@nospam.in fovis.co.ukschr eef in berichtnews:ua* *************@T K2MSFTNGP05.phx .gbl...
Hi Seth
It is true that I am opening a global connection. Executing only some of
sql queries will cause problem with the integrity of the data in the
database. By using a global connection I was hoping to provide a
guaranteed connection to all queries reducing any expected problems. Is
there a way to ensure that all queries get executed or none?
Thanks
Regards
"rowe_newsgroup s" <rowe_em...@yah oo.comwrote in message
news:11******** *************@l 77g2000hsb.goog legroups.com...
On May 3, 11:55 am, "John" <J...@nospam.in fovis.co.ukwrot e: Hi
>I have a vb.net app that opens an access database runs several sql action queries on the tables and closes the db. This is done every few minutes. The problem is that sometimes I get an error 'ExecuteNonQuer y requires an open and available Connection. The connection's current state is closed'. My question is; is there a situation where an app automatically closes the db connection causing this error and is there a way to prevent this?
>Thanks
>Regards
I'm guessing you are trying to use a global connection object right?
If so, change the code to open a connection to the database, execute
your commands, and then close/dispose of the command and connection.
You should try to avoid using a "global" connection object at all
costs as it can lead to serious problems (with very few benefits). If
I guessed wrong, please post your code so I can take a look.
Thanks,
Seth Rowe- Hide quoted text -
- Show quoted text -
On Thu, 3 May 2007 18:53:27 +0100, "John" <Jo**@nospam.in fovis.co.uk>
wrote:
>Hi Seth
It is true that I am opening a global connection. Executing only some of sql queries will cause problem with the integrity of the data in the database. By using a global connection I was hoping to provide a guaranteed connection to all queries reducing any expected problems. Is there a way to ensure that all queries get executed or none?
Use a proper database?
google: "ado.net transactions" This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: dustin lee |
last post by:
Over the years I've gotten out of the habit of explicitly closing file
objects (whether for reading or writing) since the right thing always
seems to happen auto-magically (e.g. files get written to disk with no
missing data). I've recently started do the same thing with database
connections. I'm wondering if anyone has had trouble with this sort
of "lazy" programming style. My assumption is the the database
connection will get closed...
|
by: MC |
last post by:
Hi!
I have noticed this strange problem I cannot explain when I connect to sql
server using .net:
I use a .NET app to connect to a sql server database. When I do so, two
strange things happen at the database.
I can watch them in Enterprise Manager's Current Activity pane, and
refreshing it.
|
by: Graham Taylor |
last post by:
I've tried posting this in the 'microsoft.public.access' but I will post it
here also, as I think it might be the webserver which is causing my problem.
---------
I have an Access 2003 database which is in the "fpdb" folder of my
webserver. Its located there so that I can use asp to build a web-based
front-end for users to read the database -
http://www.nist.ac.th/maths/test1.asp
The MBD file is edited using Access (2003) and opening...
|
by: Medved |
last post by:
Hi,
We have not a smallest access database (30 tables, 160 queries,35
forms,40 reports,15 pages) with some links to other databases and some
sql queries from other databases.The databse is not using many
advanced features and there are only about 15 simple macros.
Recently we have a problem with a need to repair database (2 -4 times
a week).
What is even more alarming is that 2 times happend that even after
repair we could not use...
|
by: Mike Knight |
last post by:
(I've also posted this problem on microsoft.public.excel.programming)
I have a MS Access 2003 Database named "AS400 Fields.mdb". This
database contains links to tables on an AS400.
In MS Excel 2003, I have VBA code that creates and executes queries
using the Access database, and returns the results to an Excel sheet.
The first time the query is executed, results are returned to Excel in
usually less than 10 seconds. However, if the...
| |
by: nick_faye |
last post by:
Hi,
I am still a newbie to VB and using MS Access 2000. I am currently
trying to provide a preview of reports before printing them. My
program is simple:
AC.DoCmd.OpenReport "MyReport", acViewPreview
AC.Visible = True
AC.DoCmd.ShowToolbar "Print Preview", acToolbarNo
AC.DoCmd.ShowToolbar "Menu Bar", acToolbarNo
|
by: nicole |
last post by:
I have a problem.
In two cases the access database is closing completely (but leaves the .ldb
file behind.).
I just added a new form and now when I switch from the design view to the
preview via the icon button it closes the whole database. It does not always
happen, but repeatingly. The second occasion is when I am in the Viasual
Basic code and want to save something and compile it, then it is closely
itself completely, too.
I check my...
|
by: Vegar Hansen |
last post by:
Hello everone.
Can somebody help me?
When I run my code I can read, write to and delete from database, but when I
have done one of these things and try to copy the databasefile from my
folder to an other folder with Windows Explorer the system "hangs up" for a
couple of minutes. It seems like the databasefile is not closed. But after
2 - 3 minutes the system recover, and I can copy the file without any system
"hangups".
|
by: Charles Law |
last post by:
For some reason, when I click the X to close my MDI parent form, the action
appears to be re-directed to one of the MDI child forms, and the parent
remains open. I am then unable to close the application.
What should happen, is that the main MDI form should close, taking the child
forms with it. There is code to loop through the child forms, remove the
controls on each of them, and then close the form, but this code should
execute only...
|
by: Martin B |
last post by:
Hallo!
I'm working with C# .NET 2.0, implementing Client/Server Applications which
are connecting via Network to SQL-Server or Oracle Databases.
To stay independent from the underlaying Database I use
System.Data.Common.DBConnection and .DBCommand.
How can I keep aware from connection losses (network not availeable,
db-server not available...)?
Are there any strategies to detect this broken connections, and how can I
|
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 usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
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 most users, this new feature is actually very convenient. If you want to control the update process,...
|
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
| |
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
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
| |