ok right now I am getting this error Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding. Description: An unhandled exception occurred during the execution of the current web request. Please review
the stack trace for more information about the error and where it originated in the code. Exception Details: System.Data.SqlClient.SqlException: Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.
Source Error: Line 139: Line 140: dbConnection.Open() Line 141: cmd.ExecuteNonQuery Line 142: label1.text = "It's Done!" Line 143: here is the code for that sub I must have something out of order or something
Sub doUpdate(Source as Object, E as EventArgs)
Dim MySQL as string = "Update sitecontent Set conheader=@conheader, condate=@condate, pageheader=@pageheader, consum=@consum, conbody=@conbody Where id=@ID"
Dim Cmd as New SQLCommand(MySQL, dbConnection)
cmd.Parameters.Add(New SQLParameter("@ID", lblID.text))
cmd.Parameters.Add(New SQLParameter("@pageheader", textbox1.text))
cmd.Parameters.Add(New SQLParameter("@conheader", textbox2.text))
cmd.Parameters.Add(New SQLParameter("@consum", freetextbox1.text))
cmd.Parameters.Add(New SQLParameter("@conbody", freetextbox2.text))
cmd.Parameters.Add(New SQLParameter("@condate", Now()))
dbConnection.Open()
cmd.ExecuteNonQuery
label1.text = "It's Done!"
label1.text=" Successfully Updated --- "
BindData
dropdownlist1.SelectedIndex=dropdownlist1.Items.IndexOf(dropdownlist1.Items.FindByValue(lblID.text))
dbConnection.Close()
End Sub
OK. I presume that the update in question is updating a single record? Can you execute the query in Query Analyzer/Access (depending upon database) and does it run in a reaosnable amount of time? I could only presume there is some problem with the connection
if it takes that long to update.
SqlCommand has a CommandTimeout property. It is the number of seconds, and in my experience, you need to make it a fair amount longer than you expect you need.
TorontoVB
Participant
765 Points
153 Posts
The timeout period elapsed error
Jul 31, 2003 07:29 PM|LINK
Sub doUpdate(Source as Object, E as EventArgs) Dim MySQL as string = "Update sitecontent Set conheader=@conheader, condate=@condate, pageheader=@pageheader, consum=@consum, conbody=@conbody Where id=@ID" Dim Cmd as New SQLCommand(MySQL, dbConnection) cmd.Parameters.Add(New SQLParameter("@ID", lblID.text)) cmd.Parameters.Add(New SQLParameter("@pageheader", textbox1.text)) cmd.Parameters.Add(New SQLParameter("@conheader", textbox2.text)) cmd.Parameters.Add(New SQLParameter("@consum", freetextbox1.text)) cmd.Parameters.Add(New SQLParameter("@conbody", freetextbox2.text)) cmd.Parameters.Add(New SQLParameter("@condate", Now())) dbConnection.Open() cmd.ExecuteNonQuery label1.text = "It's Done!" label1.text=" Successfully Updated --- " BindData dropdownlist1.SelectedIndex=dropdownlist1.Items.IndexOf(dropdownlist1.Items.FindByValue(lblID.text)) dbConnection.Close() End Subdouglas.reil...
All-Star
23315 Points
4647 Posts
Re: The timeout period elapsed error
Aug 01, 2003 01:22 AM|LINK
Programming Microsoft Web Forms
My Blog
TorontoVB
Participant
765 Points
153 Posts
Re: The timeout period elapsed error
Aug 01, 2003 01:15 PM|LINK
douglas.reil...
All-Star
23315 Points
4647 Posts
Re: The timeout period elapsed error
Aug 01, 2003 02:09 PM|LINK
Programming Microsoft Web Forms
My Blog
TorontoVB
Participant
765 Points
153 Posts
Re: The timeout period elapsed error
Aug 01, 2003 03:42 PM|LINK
douglas.reil...
All-Star
23315 Points
4647 Posts
Re: The timeout period elapsed error
Aug 01, 2003 04:31 PM|LINK
Programming Microsoft Web Forms
My Blog
TorontoVB
Participant
765 Points
153 Posts
Re: The timeout period elapsed error
Aug 01, 2003 06:11 PM|LINK
douglas.reil...
All-Star
23315 Points
4647 Posts
Re: The timeout period elapsed error
Aug 01, 2003 06:21 PM|LINK
Programming Microsoft Web Forms
My Blog