Hi Mike,
When you use the CommandBuilder, you need to assign the Command objects it generates to the DataAdapter object. Here is your code revised:
OleDbConnection m_Connection = new OleDbConnection("User ID=;DSN=;Collating Sequence=MACHINE;Data Source=\"C:\\TESTDATA\";Provider=\"VFPOLEDB.1\";Cache Authentication=False;Mask Password=False;persist security info=False;Mode=Share Deny None;Extended Properties=;MVCOUNT=1024;Encrypt Password=False");
OleDbDataAdapter m_DataAdapter = new OleDbDataAdapter("select * from customer", m_Connection);
DataSet m_DataSet = new DataSet();
m_DataAdapter.InsertCommand = null;
m_DataAdapter.UpdateCommand = null;
m_DataAdapter.DeleteCommand = null;
OleDbCommandBuilder m_CommandBuilder = new OleDbCommandBuilder (m_DataAdapter);
m_DataAdapter.InsertCommand = m_CommandBuilder.GetInsertCommand();
m_DataAdapter.UpdateCommand = m_CommandBuilder.GetUpdateCommand();
m_DataAdapter.DeleteCommand = m_CommandBuilder.GetDeleteCommand();
m_DataAdapter.Fill(m_DataSet,"customer");
m_DataAdapter.Update (m_DataSet);
>Well no go :(
>
>Here is the code I used, changed slightly.
>
>///////////////////
>OleDbConnection m_Connection = new OleDbConnection("User ID=;DSN=;Collating Sequence=MACHINE;Data Source=\"C:\\TESTDATA\";Provider=\"VFPOLEDB.1\";Cache Authentication=False;Mask Password=False;persist security info=False;Mode=Share Deny None;Extended Properties=;MVCOUNT=1024;Encrypt Password=False");
>OleDbDataAdapter m_DataAdapter = new OleDbDataAdapter("select * from customer", m_Connection);
>
>DataSet m_DataSet = new DataSet();
>m_DataAdapter.InsertCommand = null;
>m_DataAdapter.UpdateCommand = null;
>m_DataAdapter.DeleteCommand = null;
>
>OleDbCommandBuilder m_CommandBuilder = new OleDbCommandBuilder (m_DataAdapter);
>
>m_DataAdapter.Fill(m_DataSet,"customer");
>
>m_DataAdapter.Update (m_DataSet);
>//An unhandled exception of type 'System.InvalidOperationException' occurred in system.data.dll
>//Additional information: Update unable to find TableMapping['Table'] or DataTable 'Table'.
>///////////////////
>
>
>If I break out after the .FILL the dataset is their and valid, but looking at the DataAdaper their is no .UpdateCommand. I once again presume that since nowhere in the code do I specify the Primary Key, The CommandBuilder doesn't know how to seek the original record to update it. Keep in mind this is a dbf file with a cdx index file.
>
>Any other suggestions?
>
>Thanks again,
>Mike
>
>
>Mike
-----------------------------------------
Cathi Gero, CPA
Prenia Software & Consulting Services
Microsoft C# / .NET MVP
Mere Mortals for .NET MVP
cgero@prenia.comwww.prenia.comWeblog: blogs.prenia.com/cathi