I have a try-catch for oledbconnection like this:
try
{
OleDbConnection Connection;
using (Connection = new OleDbConnection("Provider=MSDAORA.1;Data Source=DATABASE:1521/orcl//orcl1;Persist Security Info=True;Password=PASS;User ID=USER"))
{
Connection.Open();
v1 = 1;
Connection.Close();
}
}
catch (Exception)
{
v1 = 0;
}
When I can't connect database, try going to catch and return v1 = 0
. It's working but when connection waiting so much(for example 30-40 seconds), try trying to connect and page waiting so much.
I tried Connect Timeout
for oledbconnection
but does not working.
I need to use try for few secs, if any problem, need to go catch.
How can I do that?