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



The information in this article applies to:

  • Microsoft ADO.NET (included with the .NET Framework) 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 "tablename"
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.

MORE INFORMATION

Steps to Reproduce the Behavior

  1. Start Microsoft Visual Studio .NET, and then create a new Microsoft Visual Basic Windows Application.
  2. Open Form1.vb, and then paste the following code at the beginning of the form:
    Imports System.Data.OleDb
    					
  3. 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("Provider=VFPOLEDB.1;Data Source=C:\Program Files\Microsoft Visual FoxPro 7\Samples\Tastrade\Data\tastrade.dbc;")
            Dim myDataAdapter As New OleDbDataAdapter()
            myDataAdapter.SelectCommand = New OleDbCommand("select * from Employee", myConn)
            Dim CB As OleDbCommandBuilder = New OleDbCommandBuilder(myDataAdapter)
    
            myConn.Open()
    
            Dim DS As DataSet = New DataSet()
            myDataAdapter.Fill(DS, "Employee")
    
            DS.Tables(0).Rows(0).Item("Last_name") = "Buchanann"
    
            myDataAdapter.Update(DS, "Employee")
    
            myConn.Close()
    					
  4. 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

REFERENCES

For additional information, click the article number below to view the article in the Microsoft Knowledge Base:

310448 INFO: OLE DB .NET Managed Provider Does Not Support Some OLE DB Providers in Visual Basic .NET


Modification Type:MinorLast Reviewed:3/9/2006
Keywords:kbDatabase kbprb kbSystemData KB316548 kbAudDeveloper