Link to home
Create AccountLog in
Avatar of starship_wars
starship_wars

asked on

Web application SQL shows several AWAITING COMMAND

I've got this ASP1.1 web application that displays data from SQL Server 2000.  When the page loads, I use sp_who to see the spid and userid of my app, status is 'sleeping' and cmd is 'AWAITING COMMAND'.  On some postbacks, a new row is added to the sp_who with new spid, same userid of my app with same status and cmd.

What could be causing this?  How can I reduce these?

I am thinking it is database connections.  In the code, a conn object is created, during various method it is opened, sometimes SqlDataReaders are used with .ExecuteReader, reader is closed and conn is closed in each method's Finally clause.  
Try
            command = New SqlCommand(strCommand, conn1)
            myReader = command.ExecuteReader(System.Data.CommandBehavior.Default)
            destField.Items.Add(New ListItem("", 0))
            While (myReader.Read())
                destField.Items.Add(New ListItem(CStr(Trim(myReader("Product_Name"))), CInt(myReader("Product_ID"))))
            End While
Finally
            myReader.Close()
ASKER CERTIFIED SOLUTION
Avatar of TheMegaLoser
TheMegaLoser
Flag of Sweden image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
SOLUTION
Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.