BUG: Error message when you try to obtain schema information from a SQL Server 2005 Mobile Edition database by using the SqlCeConnection.GetSchema method: "NotSupportedException" (912435)



The information in this article applies to:

  • Microsoft SQL Server 2005 Mobile Edition

BUG #: 10895 (SQL Server CE)SQL Server CE:10895

SYMPTOMS

Consider the following scenario:
  • You create a smart device project in Microsoft Visual Studio 2005.
  • You try to obtain schema information from a Microsoft SQL Server 2005 Mobile Edition (SQL Server Mobile) database by using the SqlCeConnection.GetSchema method. For example, you try to obtain specific schema information about a column or about a table.
In this scenario, you receive the following error message:
NotSupportedException
This problem occurs when you use one of the following versions of the SqlCeConnection.GetSchema method:
  • SqlCeConnection.GetSchema(CollectionName)
  • SqlCeConnection.GetSchema(CollectionName, RestrictionValues)
Note In these versions of the SqlCeConnection.GetSchema method, CollectionName is a placeholder for the schema name. RestrictionValues is a placeholder for a set of restriction values for the requested schema.

CAUSE

This problem occurs because these versions of the SqlCeConnection.GetSchema method are not supported in SQL Server Mobile.

WORKAROUND

To work around this problem, you can obtain schema information about a data source by querying from the INFORMATION_SCHEMA views. For more information about the INFORMATION_SCHEMA views, see the "More Information" section.

Note You can also use the public properties of the SqlCeConnection object to obtain limited schema information about a data source. For example, you can use the Database property and the ServerVersion property.

STATUS

Microsoft has confirmed that this is a bug in the Microsoft products that are listed in the "Applies to" section.

MORE INFORMATION

The following table lists the INFORMATION_SCHEMA views that are supported by SQL Server Mobile.
ViewContains information about
COLUMNSColumns that can be accessed by the current user in the current database
INDEXESIndexes in the current database
KEY_COLUMN_USAGEKeys in the current database
PROVIDER_TYPESData types that are supported in SQL Server Mobile
TABLESTables that can be accessed by the current user in the current database
TABLE_CONSTRAINTSTable constraints in the current database
REFERENTIAL_CONSTRAINTSForeign constraints in the current database
You can obtain schema information from these views by using the fully qualified name of the INFORMATION_SCHEMA views. For example, you can use the following Transact-SQL statement to obtain schema information about a specific table from the INFORMATION_SCHEMA.TABLES view.
SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME='<TableName>'
Note In this Transact-SQL statement, <TableName> is a placeholder for the table name that you specify.

REFERENCES

For more information about the public properties of the SqlCeConnection object, visit the following Microsoft Developer Network (MSDN) Web site:

Modification Type:MajorLast Reviewed:2/1/2006
Keywords:kbprb KB912435 kbAudDeveloper kbAudITPRO