Click here to Skip to main content
15,906,341 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
Hello everybody
I have following code to write some values to a table every one second to a remote server on shared hosting. Being on shared hosting alot of time it gives SEVER BUSY error, i was looking for a some check or loop that would check if Server was busy to re try it in 5 seconds and keep doing it until it starts writing again....any idea how to do it??? thanks
C#
cmd = new SqlCommand("insert into DC values('" + Rate.Text + "')", con);
cmd.ExecuteNonQuery();
Posted
Updated 13-Nov-11 12:28pm
v2
Comments
DaveAuld 13-Nov-11 18:28pm    
That is far too frequent to write updates to a shared hosting solution. It would be better to buffer a local batch of updates, and then connect and push these all at once, reducing the frequency of connections.
[no name] 13-Nov-11 19:56pm    
Agreed. You should post this as solution
EricThe 13-Nov-11 20:46pm    
Do you have an example of link of an example for how to buffer and batch upload? thanks
[no name] 13-Nov-11 19:58pm    
Every second is far too frequent. With network latency and traffic I doubt you are getting that frequency anyway.

1 solution

In stead of writing polling logic, you can try using CallBack method.
 
Share this answer
 

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