To get column information with SqlClient or other providers you do:
DataTable schema = conn.GetSchema("Columns", new string[4] { conn.Database, null, "products", null });
With MySQL Connector/NET is different:
DataTable schema = conn.GetSchema("Columns", new string[4] { null, conn.Database, "products", null });
Note that the first 2 items in the array are swapped.
The difference is that MySQL Connector/NET puts the database name in the TABLE_SCHEMA column, while other providers put it in the TABLE_CATALOG column and use TABLE_SCHEMA for other information (in SQL Server TABLE_SCHEMA is typically dbo).
Is this behavior by design or a bug ?
DataTable schema = conn.GetSchema("Columns", new string[4] { conn.Database, null, "products", null });
With MySQL Connector/NET is different:
DataTable schema = conn.GetSchema("Columns", new string[4] { null, conn.Database, "products", null });
Note that the first 2 items in the array are swapped.
The difference is that MySQL Connector/NET puts the database name in the TABLE_SCHEMA column, while other providers put it in the TABLE_CATALOG column and use TABLE_SCHEMA for other information (in SQL Server TABLE_SCHEMA is typically dbo).
Is this behavior by design or a bug ?