Microsoft KB Archive/316548

= You receive an error message when you try to use the OLE DB Provider for Visual FoxPro with the OleDbCommandBuilder object =

Article ID: 316548

Article Last Modified on 3/9/2006

-

APPLIES TO


 * Microsoft ADO.NET 1.0

-



This article was previously published under Q316548



This article refers to the following Microsoft .NET Framework Class Library namespace:
 * System.Data.OleDb



SYMPTOMS
If you try to use the Microsoft OLE DB Provider for Visual FoxPro (VFP) with the OleDbCommandBuilder object, you may receive an error message that resembles the following:

An unhandled exception of type 'System.InvalidOperationException' occurred in system.data.dll

Additional information: Dynamic SQL generation is not supported against a SelectCommand that does not return any base table information.

If you create a Connection object in the Server Explorer in the .NET environment, and you try to drag a table to the form to create a DataAdapter object, you may receive the following error message:

The wizard detected the following problems when configuring the data adapter for &quot;tablename&quot;

Details -

Generated Select Statement.

Error in SELECT clause: expression near '['. Error in FROM clause: near '['. Unable to parse query text.



CAUSE
The current version of the OLE DB Provider for Visual FoxPro is not certified to work with the OLE DB .NET Managed Provider.

WORKAROUND
To work around the problem, manually code the SelectCommand, UpdateCommand, DeleteCommand, and InsertCommand properties of the DataAdapter.



Steps to Reproduce the Behavior
 Start Microsoft Visual Studio .NET, and then create a new Microsoft Visual Basic Windows Application.  Open Form1.vb, and then paste the following code at the beginning of the form: Imports System.Data.OleDb   Paste the following code in the Load event of Form1. Modify the connection string as needed to point to the tastrade sample Visual FoxPro database. Dim myConn As New OleDbConnection(&quot;Provider=VFPOLEDB.1;Data Source=C:\Program Files\Microsoft Visual FoxPro 7\Samples\Tastrade\Data\tastrade.dbc;&quot;) Dim myDataAdapter As New OleDbDataAdapter myDataAdapter.SelectCommand = New OleDbCommand(&quot;select * from Employee&quot;, myConn) Dim CB As OleDbCommandBuilder = New OleDbCommandBuilder(myDataAdapter)

myConn.Open

Dim DS As DataSet = New DataSet myDataAdapter.Fill(DS, &quot;Employee&quot;)

DS.Tables(0).Rows(0).Item(&quot;Last_name&quot;) = &quot;Buchanann&quot;

myDataAdapter.Update(DS, &quot;Employee&quot;)

myConn.Close  Press the F5 key to compile and run the project. You receive the following error message:

An unhandled exception of type 'System.InvalidOperationException' occurred in system.data.dll



