MySql.Data.MySqlClient.MySqlConnection.GetSchema C# (CSharp) Method

GetSchema() public method

Returns schema information for the data source of this DbConnection using the specified string for the schema name.
public GetSchema ( string collectionName ) : DataTable
collectionName string Specifies the name of the schema to return.
return System.Data.DataTable
        public override DataTable GetSchema(string collectionName)
        {
            if (collectionName == null)
                collectionName = SchemaProvider.MetaCollection;

            return GetSchema(collectionName, null);
        }

Same methods

MySqlConnection::GetSchema ( ) : DataTable
MySqlConnection::GetSchema ( string collectionName, string restrictionValues ) : DataTable

Usage Example

Ejemplo n.º 1
0
 public bool ConnectToDataBase(string strConnect)
 {
     sqlConnection = new MySqlConnection(strConnect.ToString());
     try
     {
         sqlConnection.Open();
         listTables = new List<string>();
         using (DataTable dt = sqlConnection.GetSchema("Tables"))
         {
             if (dt != null && dt.Rows.Count > 0)
             {
                 listTables.Capacity = dt.Rows.Count;
                 foreach (DataRow row in dt.Rows)
                     listTables.Add(row["table_name"].ToString());
             }
         }
         sqlConnection.Close();
         //string query = "select * from sys.tables where type_desc = 'USER_TABLE'";
     }
     catch (Exception ex)
     {
         System.Windows.Forms.MessageBox.Show(ex.Message);
         return false;
     }
     return true;
 }
All Usage Examples Of MySql.Data.MySqlClient.MySqlConnection::GetSchema