473,387 Members | 1,561 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.

connection close problem

During form Load, I want to fill in the dataset and the close the connection
at once. However, In SQL Server, I still find that the connection exists and
the status is "AWAITING COMMAND". My client 's IT admin complaint that this
connection should be disappear.
I really got no idea about SQL admin Please help ~~
Try
dsGLJnHeader.Clear()
daGLJnHeader.SelectCommand = New SqlCommand
daGLJnHeader.TableMappings.Add("Table", "GLJnHeader")
daGLJnHeader.SelectCommand.CommandText = "select " &
strSQLData_H & " from GLJnHeader " & strSQLwhere & " ORDER BY voucherno desc
"
daGLJnHeader.SelectCommand.Connection =
dtsclass.DatabaseConnection.GetDbConnection("ACCOU NT")
daGLJnHeader.Fill(dsGLJnHeader, "GLJnHeader")

Catch err As Exception
MessageBox.Show(err.Message, "Form Load-Fille-GlJnHeader")
Finally
daGLJnHeader.close
end try
Feb 23 '07 #1
1 1035
Agnes wrote:
During form Load, I want to fill in the dataset and the close the connection
at once. However, In SQL Server, I still find that the connection exists and
the status is "AWAITING COMMAND". My client 's IT admin complaint that this
connection should be disappear.
I really got no idea about SQL admin Please help ~~
Try
dsGLJnHeader.Clear()
daGLJnHeader.SelectCommand = New SqlCommand
daGLJnHeader.TableMappings.Add("Table", "GLJnHeader")
daGLJnHeader.SelectCommand.CommandText = "select " &
strSQLData_H & " from GLJnHeader " & strSQLwhere & " ORDER BY voucherno desc
"
daGLJnHeader.SelectCommand.Connection =
dtsclass.DatabaseConnection.GetDbConnection("ACCOU NT")
daGLJnHeader.Fill(dsGLJnHeader, "GLJnHeader")

Catch err As Exception
MessageBox.Show(err.Message, "Form Load-Fille-GlJnHeader")
Finally
daGLJnHeader.close
end try

What kind of objects are you using? It looks like daGLJHeader might be a
data adapter, except a data adapter doesn't have a Close method.

I see the code that looks like you are getting a database connection and
attaching it to the object, but I don't see any code that closes it.
Unless of course closing the object also closes the attached connection,
but without knowing what kind of object it is, I can't tell if that is
happening or not.

--
Göran Andersson
_____
http://www.guffa.com
Feb 23 '07 #2

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

Similar topics

0
by: Bob | last post by:
I have an ASP.NET web application that has been running without any problems for a while. I recently transferred the site to shared hosting and had multiple users start to use the site. The problem...
3
by: sam | last post by:
Hello group, I have a function which is used to initiate sqlDataReader object. I was trying to invoke the close method on the DataReader object but cant really do that as the function returns a...
7
by: Tumurbaatar S. | last post by:
Is it so important to close database connections? As I understand, after processing a request and sending a response, page object destroyed. So all used connections also destroyed. Yes?
35
by: Eric Sabine | last post by:
In my Finally block, I was using cn.close (where cn is an ADO.NET connection object, SQLConnection to be exact) and then I came across the following in some microsoft code. If Not cn Is Nothing...
17
by: Alan Silver | last post by:
Hello, I have a generic method in a utility class that grabs an sqldatareader and returns it. Due to the fact that (AFAIK), you can't close the database connection before you've read the data,...
8
by: Greg Strong | last post by:
Hello All, The short questions are 1 Do you know how to make DSN connection close in Access to Oracle 10g Express Edition? &/or 2 Do you know how to make a DSN-less pass-through query...
16
by: crbd98 | last post by:
Hello All, Some time ago, I implemented a data access layer that included a simple connectin pool. At the time, I did it all by myself: I created N connections, each connection associated with...
20
by: fniles | last post by:
I am using VB.NET 2003, SQL 2000, and SqlDataReader. As I read data from tblA, I want to populate tblB. I use SQLDataReader for both tables. I do not use thread. When I ExecuteReader on tblB, I...
20
by: fniles | last post by:
I am using VS2003 and connecting to MS Access database. When using a connection pooling (every time I open the OLEDBCONNECTION I use the exact matching connection string), 1. how can I know how...
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: 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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
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
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...

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.