Connections on a database

  • Hi There

    How does sql handle data connections in vb .net?

    using vb .net web project

    simple web form

    If Not IsPostBack Then

    Dim mycn As New SqlClient.SqlConnection

    mycn.ConnectionString = "data source= ...."

    mycn.Open()

    mycn.Close()

    End If

    SQL server still thinks there is a connection open even if I close the connection straight away.

    (We're been using the stored procedure sp_who2 from the master database to give details of connections)

    Is the connections handled by SQL  or ADO.net?

    Any help would be great.

  • I'm shooting in the dark here... but have you tried destroying the connection object before running sp_who2?

    Maybe that the connection is still there, but simply sleeping untill you actually run : set mycn = nothing

  • Remi,

    Thanks for reply, I've tried adding the mycn = nothing however the store procedure says the connection  still exists with the status is set to sleeping.

     

     

  • The only other possibility I can think of is that you have one connection from earlier runs of the page and that wasn't closed then... Maybe you could try to kill that spid and rerun the page and rerun sp_who2. But after that I'm out of ideas.

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply