Documentation Home
MySQL Connector/Net Developer Guide
Related Documentation Download this Manual Collections

The collections can be broadly grouped into two types: collections that are common to all data providers, and collections specific to a particular provider.


The following collections are common to all data providers:

  • MetaDataCollections

  • DataSourceInformation

  • DataTypes

  • Restrictions

  • ReservedWords


The following are the collections currently provided by MySQL Connector/Net, in addition to the common collections above:

  • Databases

  • Tables

  • Columns

  • Users

  • Foreign Keys

  • IndexColumns

  • Indexes

  • Foreign Key Columns

  • UDF

  • Views

  • ViewColumns

  • Procedure Parameters

  • Procedures

  • Triggers

Example Code

A list of available collections can be obtained using the following code:

using System;
using System.Data;
using System.Text;
using MySql.Data;
using MySql.Data.MySqlClient;

namespace ConsoleApplication2
    class Program

        private static void DisplayData(System.Data.DataTable table)
            foreach (System.Data.DataRow row in table.Rows)
                foreach (System.Data.DataColumn col in table.Columns)
                    Console.WriteLine("{0} = {1}", col.ColumnName, row[col]);

        static void Main(string[] args)

            string connStr = "server=localhost;user=root;database=world;port=3306;password=******;";
            MySqlConnection conn = new MySqlConnection(connStr);

                Console.WriteLine("Connecting to MySQL...");

                DataTable table = conn.GetSchema("MetaDataCollections");
                //DataTable table = conn.GetSchema("UDF");

            catch (Exception ex)

Further information on the GetSchema() method and schema collections can be found in the Microsoft .NET documentation.

User Comments
Sign Up Login You must be logged in to post a comment.