My company is using SQL Server Compact to store and manage a local database and I need to get the primary key information from the database tables.
I have used OleDbConnection.GetSchema() in the past to get this information from Access databases using Jet and OLE drivers. But it appears that SqlCeConnection.GetSchema() throws a NotImplementedException (or rather that it returns DBConnection.GetSchema() which throws the same exception).
I don’t need all of the information normally returned by GetSchema(), just the names of the PK’s. Is there a good way to find out the Primary Key for a table in a SQL Server Compact database?
NOTE: The above method references are not static function calls. Consider the class name to be an object reference of that type.
1 Answer