473,776 Members | 3,492 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

left open sql connection-original post 4/2

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 developed and I have modified.
I did add a section of code that uses a data connection, data adapter, and a dataset. It calls a stored procedure on the server. I did not use open or close in the code but it seemed to be working ok. The stored procedure pulls data from a few tables and displays it on the data grid.
Do I need to implicitly use the open and close statements for the connection or data adapter for this or does the fill automatically open the connection and then close it?

SqlDataAdapter1 .Fill(ds_vhist, "dbo_pg_parmsel _past_reservati on")
Vhistgrid.DataB ind()

Thanks
Paul.
Nov 18 '05 #1
2 1721
I think I found the answer to the posted question, perhaps someone could confirm if they have time. From page 208 of Dev Web applications (Microsoft) it states Close the database connection if you explicitly opened it in a previous step using the open method. Invoking commands without first invoking the Open method implictitly opens and closes the connection with each request.
So for the code I am using the fill method with out a prior open method so sounds like the connection is automaticall
openned and closed after this fill method is executed

SqlData_adapter _name.Fill(data set_name, "stored_procedu re_name"
Also is there any advantage in using the open and close methods
Thanks Paul
Nov 18 '05 #2
I think I found the answer to the posted question, perhaps someone could confirm if they have time. From page 208 of Dev Web applications (Microsoft) it states Close the database connection if you explicitly opened it in a previous step using the open method. Invoking commands without first invoking the Open method implictitly opens and closes the connection with each request.
So for the code I am using the fill method with out a prior open method so sounds like the connection is automaticall
openned and closed after this fill method is executed

SqlData_adapter _name.Fill(data set_name, "stored_procedu re_name"
Also is there any advantage in using the open and close methods
Thanks Paul
Nov 18 '05 #3

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

Similar topics

0
1300
by: Shailesh Humbad | last post by:
Many a page has ADO Connection objects that were opened but never closed. The Connection object allocates its own resources when it is opened. When the object goes out of scope without being explicitly closed, the resources ASP allocated for it are freed, but the resources it allocated on its own are not. These eventually clutter up the server and slow it down to a crawl. My question is, is there a way to track down these orphaned...
1
2567
by: C Sharp beginner | last post by:
I'm sorry about this verbose posting. This is a follow-up to my yesterday's posting. Thanks William for your reply. I understand it is a good practice to open connections as late as possible and close them as early as possible. My requirement is as follows: I'm developing a class library that will be instantiated by a COM component. My class library contains functions that perform lot of mathematical calculations and read a lot of data...
0
1145
by: Yama | last post by:
Good Afternoon to all, What will be the best way to capture ServerClick from a a left menu generated by a datalist? Private Sub GetReports() Try Dim cmd As New SqlCommand Dim conn As New SqlConnection(ConfigurationSettings.AppSettings("ConnectionString")) cmd.CommandText = "GetReportListing" cmd.CommandType = CommandType.StoredProcedure
1
314
by: Paul | last post by:
Hi just wondering what could cause a left open SQL connection as this has only occured 2 times in the last week. The error it creates is when a web app tries to open a connection an error message states, it is already open. The process was then killed to close the connection. The usage is pretty low around 15 workstations. Looking at the code it appears that all connections get closed, so thinking it is not a problem with the code. Thanks...
1
1206
by: Yama | last post by:
Good Afternoon to all, What will be the best way to capture ServerClick from a a left menu generated by a datalist? Private Sub GetReports() Try Dim cmd As New SqlCommand Dim conn As New SqlConnection(ConfigurationSettings.AppSettings("ConnectionString"))
3
3022
by: Dan Sikorsky | last post by:
I can send email using C# and SMTP, but keep closing the connection before the .eml file has left the Queue folder. The length of time the .eml file stays in the Queue folder is dependent on the size of that file; big or many attachments increases the time. If I start an internet connection, issue the smtp mail send and then close the connection in my C# program, I need to wait until the .eml file has left the Queue folder. Otherwise,...
0
2065
by: Dan Sikorsky | last post by:
This is a C# console app using SMTP to send an email. The .EML file stays in the Queue folder because I close down the Internet Connection prematurely. What's the best way to keep the Internet Connection live until the IIS server is done sending the email, as evidenced by the .EML file leaving the Queue folder. I can send email using C# and SMTP, but keep closing the connection before
17
13210
by: petermichaux | last post by:
Hi, Is it possible for an AJAX request to be left open for multiple responses? This could avoid repetitive polling of the server. Thanks, Peter
7
13586
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, why the error says ExecuteReader. What does it mean ? When I get this error, is there a way for me...
2
1929
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 you just return a still open connection to the pool. When I open a connection I get an already open connection to the database. Is this correct understood ?
0
10117
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10056
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,...
0
8949
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 launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7467
isladogs
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...
0
6721
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();...
0
5365
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...
1
4027
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
2
3620
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2857
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.