Microsoft KB Archive/325790

From BetaArchive Wiki

Article ID: 325790

Article Last Modified on 9/27/2005



APPLIES TO

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



This article was previously published under Q325790

SYMPTOMS

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".

Details:

Generated Select Statement.

Error in Select clause: expression near '['
Error in From clause: near '['
Unable to parse query text.


CAUSE

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]
                

RESOLUTION

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
                

WORKAROUND

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
                        


STATUS

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.

MORE INFORMATION


Additional query words: IBMDADB2

Keywords: kbbug kbfix kbqfe kbvs2002sp1sweep kbvs2002sp1fix kbhotfixserver KB325790