Click here to Skip to main content
15,891,204 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello,

I have a page in asp.net that execute a function that generate a query to update multiple row from a database

that function is taking a long time to finish which lead to a "The wait operation timed out" exception

what is the best way to execute this function and jump over the time out exception that the system throw on long time execution

suggest me options to deal with such problem.

note that my database has large amount of data and this error appears when updating multiple rows

the query that im using is :"
SQL
Update Emails Set Status='Active' Where ID in (" & hardmailsIDs & ")"


the function vb that is used to get those ids in a string (hardmailsIDs) using a loop ..
VB
For Each dr As DataRow In hardbouncedmail.Rows
                   hardmails = (hardmails & Convert.ToString(",")) + "'" + Convert.ToString(dr("Email") + "'")
                   Dim IdRow() As DataRow = selectedmailIDs.Select("Email='" & dr("Email") & "'")
                   hardmailsIDs = (hardmailsIDs & Convert.ToString(",") + IdRow(0).Item("ID").ToString())
               Next


the number of id may reach 50,000 row

thanks.
Posted

1 solution

I guess you should consider using stored procedures, they are certainly not any faster SQL-Wise, but consider that you are using a loop in your code, I am sure they can make some difference.
 
Share this answer
 
Comments
Hidhoud1991 5-Sep-14 4:00am    
the id are taken from another database i cant use a store procedure for that purpose

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900