I am using the following code, get all data records from MS SQL database and I update every single record Try to do Code is used in any web server. The problem is, if I have 1000 data records then the code runs fine, but now I have 20000 data records which previously came back with a timeout. Then I set the CMD. Com Timeout to zero near zero Now when I call the IE WebSVC function, the IE window is still empty and still tries to load something but nothing happens, only 150 datacarcord updates are made.
Do you have any ideas where the problem can be? Code is not the best, so what should I change?
Thanks a lot! Viswesignij
Private string AddNewOrgBez () {{SqlConnection sqlconn = New SqlConnection (this.connectionString); SqlCommand CMD; SqlDataReader Reader; Sqlconn.Open (); CMD = New SQL Commands ("Select * FROM dbo.mydata", sqlconn); CMD. Comma timeout = 0; Reader = CMD Spare reader (); While (reader.Read ()) {// Felder Holan String Okurezelle = Reader ["O_Kurz"]. Toasting (); String bijichinung = reader ["OBZ"]. Toasting (); String [] lines = containaioergage (bijichung); String sqlcmd = "UPDATE dbo.mydata SET WEB_OBEZ1 = '" + + [0] + "', WEB_OBEZ2 = '" + rows [1] + "', WEB_OBEZ3 = '" + lines [2] + "' WHERE O_KURZ = '"+ Okurzel +"' "; SqlConnection sqlconn2 = New SqlConnection (this.connectionString); sqlconn2.Open (); SqlCommand cmd2 = New SqlCommand (sqlcmd, sqlconn2); cmd2.CommandTimeout = 0; cmd2.ExecuteNonQuery (); sqlconn2 .close ();} reader. (); Sqlconn.Close (); return "ok";} hold (ex before) {return ex.message;}}
You were using two separate connections to read and update, and one of them had to stop the other Tests that when you read all your data first, then he started to work.
Comments
Post a Comment