lcftahoe
asked on
operation cancelled by user
I have an asp.net datagrid binding from a sql server stored procedure query. When the number of records passes a certain point (not much ~50-100 records), I am getting the error "operation cancelled by user" on the datagrid.databind line. I set the sessionState timeout very high (3000), and switched from a remote database to a local one. What could be going on here?
ASKER
no threading, pretty simple code...
Private Sub loadGrid(ByVal dbConn As DB)
Dim rdGet As SqlDataReader
rdGet = dbConn.getActivities
grdActivities.DataSource = rdGet
grdActivities.DataBind()
rdGet.Close()
If grdActivities.Items.Count = 0 Then
grdActivities.Visible = False
lblActivity.Text = "No Activities Found"
lblActivity.Visible = True
Else
grdActivities.Visible = True
lblActivity.Visible = False
End If
End Sub
[and from the DB object:]
Public Function getActivities() As SqlDataReader
'GETS ALL ACTIVITIES
'RETURNS activity_id,activity_type, title, description, active, location,URL, phone, address, map_url, type_description
'ORDERED BY type_description, title
Dim rdGet As SqlDataReader
Dim cmdGet As New SqlCommand()
cmdGet.Connection = connData
cmdGet.CommandType = CommandType.StoredProcedur e
cmdGet.CommandText = "getActivities"
rdGet = cmdGet.ExecuteReader
cmdGet.Cancel()
Return rdGet
End Function
Private Sub loadGrid(ByVal dbConn As DB)
Dim rdGet As SqlDataReader
rdGet = dbConn.getActivities
grdActivities.DataSource = rdGet
grdActivities.DataBind()
rdGet.Close()
If grdActivities.Items.Count = 0 Then
grdActivities.Visible = False
lblActivity.Text = "No Activities Found"
lblActivity.Visible = True
Else
grdActivities.Visible = True
lblActivity.Visible = False
End If
End Sub
[and from the DB object:]
Public Function getActivities() As SqlDataReader
'GETS ALL ACTIVITIES
'RETURNS activity_id,activity_type,
'ORDERED BY type_description, title
Dim rdGet As SqlDataReader
Dim cmdGet As New SqlCommand()
cmdGet.Connection = connData
cmdGet.CommandType = CommandType.StoredProcedur
cmdGet.CommandText = "getActivities"
rdGet = cmdGet.ExecuteReader
cmdGet.Cancel()
Return rdGet
End Function
ASKER
ps I tried loading the site on a different web server and seeing the same problem so it seems like a project setting I'm missing or code issue not a server issue???
cmdGet.Cancel() looks like bcz of that...
Dim rdGet As SqlDataReader
Dim cmdGet As New SqlCommand()
cmdGet.Connection = connData
cmdGet.CommandType = CommandType.StoredProcedur e
cmdGet.CommandText = "getActivities"
rdGet = cmdGet.ExecuteReader(Comma ndBehavior .CloseConn ection)
Return rdGet
i guess that's what u need to do...
where is the conn object..like SQLConnection ...and myconnection.Open()
Dim cmdGet As New SqlCommand()
cmdGet.Connection = connData
cmdGet.CommandType = CommandType.StoredProcedur
cmdGet.CommandText = "getActivities"
rdGet = cmdGet.ExecuteReader(Comma
Return rdGet
i guess that's what u need to do...
where is the conn object..like SQLConnection ...and myconnection.Open()
ASKER
Hmmm... ok got rid of the cmdGet.cancel and it is loading ok now. This has been somewhat sporadic though so let me watch that for awhile before I close the issue. Can you explain why this would cause this behavior sporadically and/or only when the amount of records returned reached a certain point - want to understand this for the future!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
can u post the code...