private bool OpenDbConnection(SqlConnection sql_con_obj)
{
try
{
SqlConnection.ClearPool(sql_con_obj);
SqlConnection.ClearAllPools();
if (sql_con_obj.State == ConnectionState.Closed || sql_con_obj.State == ConnectionState.Broken)
{
sql_con_obj.ConnectionString = "Data Source=.;Initial Catalog=Practice;User ID=sa;Password=sa";
sql_con_obj.Open();
return true;
}
else
{
return false;
}
}
catch (Exception ex)
{
ShowMessage(ex.Message);
}
}
I get following error on execution:
Error 1 '_Default.OpenDbConnection(System.Data.SqlClient.SqlConnection)': not all code paths return a value.
please suggest solution