Microsoft Knowledge Base Email Alertz

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

Search KbAlertz

Advanced Search

Receive Microsoft Knowledge Base articles by E-Mail?

Every night we scan the Microsoft Knowledge Base. If technologies you're interested in are updated, we'll send you an e-mail. You only get one e-mail a day, and only when new articles are added.

Click here to create a
FREE account
Already have an account?
[Click here to Login]











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)

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 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:
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 Compact Edition or in SQL Server Mobile Edition.

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 Compact Edition or by SQL Server Mobile Edition.
Collapse this tableExpand this table
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 Compact Edition
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:
http://msdn2.microsoft.com/en-us/library/ze4yb054(en-US,VS.80).aspx (http://msdn2.microsoft.com/en-us/library/ze4yb054(en-US,VS.80).aspx)

APPLIES TO
  • Microsoft SQL Server 2005 Compact Edition
  • Microsoft SQL Server 2005 Mobile Edition
Keywords: 
kbprb KB912435
       

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