hi everyone,
is there any way that I can programatically tell the user weather he/she is successfully connected to the database(SQL Server 2005). or connection failed.
Code is written in C#.

string Connectionstring = "....";
sqlConnection con = new sqlConnection(Conncetionstring);
con.Open();

how I can check programatically weather con.Open() is sucess of failed.

Use try..catch..finally block.

You can use like this,

string Connectionstring = "....";
sqlConnection con = new sqlConnection(Conncetionstring);
try
        {
            con .Open();
        }
        catch (SqlException exp)
        {
//assigned into string vari
            strErrorState = exp.Message;
        }