Amir
Have you instantiated the conn object with the above mentioned connection string?
Also do check if the connection is already open or not, since if the connection is already open the conn.open will throw InvalidOperationException exception resulting in your function returning false in catch statement. So ideally check this:
public string Check_conn()
{
try
{
if(!conn.IsOpen)
{
conn.Open();
conn.Close();
}
return "ok";
}
catch
{
return "failed";
}
}
Regards
Pawan