2015-04-17 98 views

回答

1

可以使用傳統存儲所有的連接,檢查連接打開,使用此代碼

if (myConnection != null && myConnection.State == ConnectionState.Closed) 
    { 
     //you can get all information about your connection string 
    } 
0

你可以從連接本身的信息。

if(connection != null && connection.state == ConnectionState.Open) 
{ 
// You can parse the connection string 'connection.ConnectionString' here for the DB name etc. or print a number. 
}