Click here to Skip to main content
15,881,424 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a sql connection in c# win form project

i want to reconnect this if connection is drop..
how to do this

thanks
Posted

The first thing you should investigate is why the connection is lost. If this is an acceptable and 'common' situation then I'd suggest using connection pooling so that after each unit of work the connection is closed by your program and re-opened where a new unit of work is started.

For more information, see SQL Server Connection Pooling (ADO.NET)[^].

Also notice both ConnectRetryCount and ConnectRetryInterval in ConnectionString[^]
 
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