Answer: With the help of
State property of SqlConnection object,we can check whether Connection is Open or Close.
It has
ConnectionState as Enum which has Open value.
For Example:-
if (con.State == ConnectionState.Open)
con.Close();
Here con is our SqlConnection object.
Asked In: Many Interviews |
Alert Moderator