////// 判断数据库是否连接 /// ///是否连接 public bool IsConnected() { SqlConnection connection = new SqlConnection(connectionString);//connectionString 数据库连接字符串 try { if (connection.State != ConnectionState.Open) { connection.Open(); } return true; } catch { return false; } }