Microsoft Knowledge Base Article
This article contents is Microsoft Copyrighted material.
©2005-©2007 Microsoft Corporation. All rights reserved.
Terms
of Use |
Trademarks
Article ID: 912435 - Last Review: March 27, 2008 - Revision: 3.2
BUG: Error message when you try to obtain schema information from a SQL Server 2005 Compact Edition database or a SQL Server 2005 Mobile Edition database by using the SqlCeConnection.GetSchema method: "NotSupportedException"
BUG #: 10895 (SQL Server CE)
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 Compact Edition (SQL Server Compact Edition) database or a Microsoft SQL Server 2005 Mobile Edition (SQL Server Mobile Edition) 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:
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.
This problem occurs because these versions of the
SqlCeConnection.GetSchema method are not supported in SQL Server Compact Edition or in SQL Server Mobile Edition.
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.
Microsoft has confirmed that this is a bug in the Microsoft products that are listed in the "Applies to" section.
The following table lists the
INFORMATION_SCHEMA views that are supported by SQL Server Compact Edition or by SQL Server Mobile Edition.
Collapse this tableExpand this table
| View | Contains information about |
| COLUMNS | Columns that can be accessed by the current user in the current database |
| INDEXES | Indexes in the current database |
| KEY_COLUMN_USAGE | Keys in the current database |
| PROVIDER_TYPES | Data types that are supported in SQL Server Compact Edition |
| TABLES | Tables that can be accessed by the current user in the current database |
| TABLE_CONSTRAINTS | Table constraints in the current database |
| REFERENTIAL_CONSTRAINTS | Foreign 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.
For more information about the public properties of the
SqlCeConnection object, visit the following Microsoft Developer Network (MSDN) Web site:
APPLIES TO
- Microsoft SQL Server 2005 Compact Edition
- Microsoft SQL Server 2005 Mobile Edition
Community Feedback System
Very often, it takes hours to solve a problem. Very often, you've looked high
and low, and have tried a lot of solutions. When you finally found it, chances
are, it was because someone else helped you. Here's your chance to give back.
Use our community feedback tool to let others know what worked for you and what
didn't.
Please also understand that the community feedback system is not warranted to be
correct, it's simply a system that we've built to let people try and help each
other. If something in a feedback response doesn't make sense to you, or you're
not comfortable making changes that the feedback talks about (like registry
edits), please consult a professional.
Thank you for using kbAlertz.com Feedback System.
-- Scott Cate