Link to home
Start Free TrialLog in
Avatar of jpchen
jpchen

asked on

loop to get data from sql

Hi,
I want to have function will wait for the row has been release from SQL. It is still lock then I need to have loop to check every 10 seconds with through exception.
Thanks!
jpc
ASKER CERTIFIED SOLUTION
Avatar of jj819430
jj819430

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of jpchen
jpchen

ASKER

if I setting up the timeout in the connection string, how to handle the time out issue?
http://www.codeproject.com/csharp/timeralarm.asp

This link can show you how to build a solid timer
Avatar of jpchen

ASKER

I don't want to use other timer, I rember there is timeout value you can add to the connection string, but how to handle the timeout issue, there is what i am not sure what to do it.
Thanks!
jpc
to set the timeout on the connection string
myConnection.ConnectionTimeout = TheAmountOfTime;
Avatar of jpchen

ASKER

thanks, but how to handle after timout?
SqlException is what I think it throws.

so do this.
try{

blah blah blah

}
catch(SqlException error)

then you can catch and handle the exception right there. Your app will know it failed. if it fails have it loop.
Avatar of jpchen

ASKER

Thanks,  but how can I just catch the timeout error, I don't want to loop with other SQL issue.