Article ID: 817183 - View products that this article applies to.
This article has been archived. It is offered "as is" and will no longer be updated.
When you create a SqlDataAdapter object for a join query that has columns only from one table that is used in the query, the FillSchema method of the SqlDataAdapter object does not include the schema for the PrimaryKey column of the table. This problem does not occur when the join query has columns from both tables.
To work around this problem, add the PrimaryKey column to the table manually. To do this, add the following statement to the code after calling the FillSchema method.
Visual Basic .NET code
Visual C# .NET code
You can use a OledbDataAdapter object instead of a SqlDataAdaptor to connect to Microsoft SQL Server.
Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.
Steps to reproduce the behavior
For more information about the DataAdapter.FillSchema method, see the following Microsoft Developer Network (MSDN) Web site:
Article ID: 817183 - Last Review: February 27, 2014 - Revision: 2.9
Contact us for more help
Connect with Answer Desk for expert help.