Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding. The statement has been terminated
Dear All,
Once i got the issue for the timeout i fixed the following in the code
"
Its a vb code you can use it in C# also
Dim ObjCon As New SqlConnection
ObjCon.ConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings("conString").ConnectionString
ObjCon.Open()
ObjCmd.Connection = ObjCon
ObjCmd.CommandText = "Select * from your table"
' Its a trick only
ObjCmd.CommandTimeout = 0
Try
ObjDr = ObjCmd.ExecuteReader
Catch ex As Exception
Response.Write("Following Error is there:" & ex.ToString() & "Kindly contact with IT Department")
End Try
If ObjDr.HasRows = True Then
DataGrid1.DataSource = ObjDr
DataGrid1.DataBind()
End If
ObjDr.Close()
ObjCon.Close()
I hope it will work with you guys
Regards
Rashid Imran Bilgrami
Once i got the issue for the timeout i fixed the following in the code
"
Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding. The statement has been terminated"
Its a vb code you can use it in C# alsoDim ObjCon As New SqlConnection
ObjCon.ConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings("conString").ConnectionString
ObjCon.Open()
ObjCmd.Connection = ObjCon
ObjCmd.CommandText = "Select * from your table"
' Its a trick only
ObjCmd.CommandTimeout = 0
Try
ObjDr = ObjCmd.ExecuteReader
Catch ex As Exception
Response.Write("Following Error is there:" & ex.ToString() & "Kindly contact with IT Department")
End Try
If ObjDr.HasRows = True Then
DataGrid1.DataSource = ObjDr
DataGrid1.DataBind()
End If
ObjDr.Close()
ObjCon.Close()
I hope it will work with you guys
Regards
Rashid Imran Bilgrami
Comments
Post a Comment
Thanks for the Comments , Your review will display soon