You receive a "Syntax Error" error message when you create an OracleDataAdapter control in a Visual Studio .NET 2003 Professional application (892464)



The information in this article applies to:

  • Microsoft Visual Studio .NET (2003), Professional Edition

SYMPTOMS

When you create an OracleDataAdapter control in a Microsoft Visual Studio .NET 2003 Professional application, you may receive one of the following error messages:
Syntax Error: Found 'FROM' inside an expression.
Syntax Error: Expecting identifier or quoted identifier.

CAUSE

This behavior occurs when one of the following conditions is true:
  • The select SQL query statement has more than one FROM clause.
  • The select SQL query statement contains a select subquery.
  • The MissingSchemaAction property of the OracleDataAdapter control is set to MissingSchemaAction.AddWithKey before you call the Fill method.

WORKAROUND

To work around this behavior, use both of the following methods:
  • Manually create the code for the select command. Do not use the Data Adapter Wizard to create the data adapter.
  • Do not set the MissingSchemaAction property to MissingSchemaAction.AddWithKey before the application calls the Fill method on the dataset.

MORE INFORMATION

Steps to reproduce the behavior

  1. Add the Northwind database tables in an Oracle database (version 8.1.7).
  2. In Visual Studio .NET 2003 Professional, create a Windows application.
  3. Add an OracleDataAdapter control to the form. The Data Adapter Configuration Wizard starts.
  4. Click Next.
  5. On the Choose Your Data Connection page, create your connection, and then click Next.
  6. On the Choose a Query Type page, click Use SQL statements.
  7. On the Generate the SQL Statements page, click Advanced options, click to clear the Generate Insert, Update and Delete statements check box, and then click OK.
  8. In the Generate the SQL Statements box, type the following statement, and then click Next:

    SELECT EmployeeID, lastname, OrderID FROM Employees, (SELECT * FROM ORDERS) DERIVEDTBL

    Note You receive the following error message:
    Syntax Error: Expecting identifier or quoted identifier
  9. Remove the sub-select query from step 8. Notice that the query works correctly.
  10. In the code properties of the OracleSelectCommand.CommandText method, change the select query to include the sub-select query.
  11. Right-click the OracleDataAdapter control, and then click Yes in the Regenerate Parameters dialog box.

    Note You receive the same error message that you received in step 8.

Modification Type:MajorLast Reviewed:1/25/2005
Keywords:kbprb KB892464 kbAudDeveloper