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