Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Connection handle is invalid
Message
 
 
À
30/11/2012 22:11:03
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Autre
Versions des environnements
SQL Server:
SQL Server 2008
Divers
Thread ID:
01558490
Message ID:
01558523
Vues:
33
>>>>Hey is there a good way to determine if a connection is still valid???
>>>
>>>In the try /catch block try to execute a simple select statement, e.g. select @@Version or something.
>>
>>IMHO this will create a lot of wasted calls to the server. In my app there are hundreds of TableUpdate() issued. And doing the above before each one will create great deal of - IMHO - load to the server. I wish there was a method - at least during debugging - to figure out if the connection dropped. By the way, I check the connection handle value in the debugger and it has a value. But apparently, for TableUpdate() to work, it is not enough.
>
>typical approach to such problems is to save time of last working time
>and to check only if time elapsed is greater than certain threshold.

In my case, everything happens pretty much within a minute. I start the application, go to this routine; try to add a record; then save. And it works with some databases and does not with others. Thank you for your suggestion.
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform