PC Review


Reply
Thread Tools Rate Thread

connection close problem

 
 
Agnes
Guest
Posts: n/a
 
      23rd Feb 2007
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("ACCOUNT")
daGLJnHeader.Fill(dsGLJnHeader, "GLJnHeader")

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


 
Reply With Quote
 
 
 
 
=?ISO-8859-1?Q?G=F6ran_Andersson?=
Guest
Posts: n/a
 
      23rd Feb 2007
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("ACCOUNT")
> 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
 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Explicitly close DataReader if I close the underlying connection?" MarkusJNZ@gmail.com Microsoft Dot NET Framework 2 1st Nov 2006 05:49 AM
Close connection problem Varangian Microsoft C# .NET 5 30th Dec 2005 12:00 AM
Server socket problem.. client sees connection close before all data received CHRISM Microsoft VB .NET 1 12th Nov 2004 02:42 PM
connection close problem sam Microsoft Dot NET 3 20th May 2004 02:44 AM
Secure Client connection close problem Grzegorz Kaczor Windows XP Work Remotely 0 16th Feb 2004 03:01 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:12 PM.