FIX: Providers fail when Visual Studio Database Designer Wizard puts brackets around the table name

This article was previously published under Q325790
This article has been archived. It is offered "as is" and will no longer be updated.
If you drag a database table from Server Explorer to a WinForm, and you are using a third-party OLE DB provider (including the IBM DB2 provider), you may receive the following error message:
The wizard detected the following problems when configuring the Data Adapter for "MyTableName".


Generated Select Statement.

Error in Select clause: expression near '['
Error in From clause: near '['
Unable to parse query text.
This issue occurs because Visual Studio Database Designer Wizard creates a SELECT statement for OleDbDataAdapter that is not valid. The SELECT statement has brackets around the table name. Many third-party providers do not support brackets around the table or schema name, so the statement fails.

Visual Studio Database Designer Wizard creates SELECT statements that are similar to the following:
SELECT MySchemaName.[MyTableName].* FROM MySchemaName.[MyTableName]				

Service pack information

To resolve this problem, obtain the latest service pack for Microsoft Visual Studio .NET. For more information, click the following article number to view the article in the Microsoft Knowledge Base:
837234 List of bugs that are fixed in Visual Studio .NET 2002 Service Pack 1

Hotfix information

The P1 version of this P2 has the file attributes (or later file attributes) that are listed in the following table. The dates and times for these files are listed in Coordinated Universal Time (UTC). When you view the file information, it is converted to local time. To find the difference between UTC and local time, use the Time Zone tab in the Date and Time tool in Control Panel.
 Date         Version      Size         File name                Platform ------------------------------------------------------------------------ Jun-27-2002  7.0.9512.0   3,600,384    Microsoft.VSDesigner.dll  x86				
If you receive the error message in the "Symptoms" section of this article while you are using Visual Studio Database Designer Wizard, you can manually change the SELECT statement to work around the issue. To manually change the SELECT statement, do the following:
  1. In Visual Studio Database Designer Wizard, right-click OleDbDataAdapter, and then select Properties.
  2. In the Property Sheet, expand SelectCommand, and then click CommandText.
  3. Make appropriate changes to the SELECT statement. Visual Studio Database Designer creates the following SELECT statement:
    SELECT MySchemaName.[MyTableName].* FROM MySchemaName.[MyTableName]					
    Change the statement to the following:
    SELECT MySchemaName.MyTableName.* FROM MySchemaName.MyTableName					
Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section. This problem was first corrected in Visual Studio .NET 2002 Service Pack 1.

Article ID: 325790 - Last Review: 10/26/2013 17:19:03 - Revision: 2.1

Microsoft Visual Studio .NET 2002 Professional Edition, Microsoft Visual Studio .NET 2002 Enterprise Architect, Microsoft Visual Studio .NET 2002 Enterprise Developer

  • kbnosurvey kbarchive kbbug kbfix kbqfe kbvs2002sp1sweep kbvs2002sp1fix kbhotfixserver KB325790