public DataTable GetTables() { DataSet ds = new DataSet(); string sql = "SELECT TABLE_CATALOG,TABLE_SCHEMA, TABLE_NAME,TABLE_TYPE FROM INFORMATION_SCHEMA.TABLES"; using (SqlConnection conn = new SqlConnection(ConnectionString)) { if (conn.State == ConnectionState.Closed) conn.Open(); SqlDataAdapter sda = new SqlDataAdapter(sql, conn); sda.Fill(ds); } return ds != null && ds.Tables.Count > 0 ? ds.Tables[0] : null; }