I am making a DAL template with C# and I am wondering what is the most efficient way to access schema information with ODBC and OleDB. I need the columns, column types, and primary key information.
thanks
For OleDb, there is an OleDbConnection.GetoleDbSchemaTable() method. I've used it with Access.
I have an example in this code on GitHub: SchemaValidator.cs
There should be a .Schema() method on OdbcConnection too IIRC.
I have noticed that the actual returned values may vary by database, so you'll want to do a fair amount of checking and debugging to see what he returned values may be.