I believe it was a problem with the connection trying to open again and it already being open? I changed the source of the page to a view in the SQL Server and it works, but now my checkboxes that I have on the data grid are disabled. Trying to work that out now.
That could be it if you are trying to use the same connection variable. I always dim my connections in the procedure I am running, and then of course close the connection at the end of the procedure. So my procedures would look something like this:
Code:
Function DoSomeWork(Param1 as string) As boolean
Dim cmd As New SqlCommand
Dim conn As New SqlConnection
Try
OpenSQLConnection(conn)
cmd = New SqlCommand
cmd.CommandText = "storedprocedurename"
cmd.CommandType = Data.CommandType.StoredProcedure
cmd.Connection = conn
With cmd
.Parameters.AddWithValue("@Param1", Param1)
.ExecuteNonQuery()
End With
Catch ex As Exception
ThrowError("Error in Insert:" & ex.ToString)
Finally
CloseConnection(conn)
End Try
End Function
and then I store my connection function in another module: