Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
DataSet Wizard against foxpro table
Message
 
 
To
11/04/2007 03:07:22
General information
Forum:
ASP.NET
Category:
ADO.NET
Miscellaneous
Thread ID:
01214294
Message ID:
01214329
Views:
11
>VS2005 professional edition.
>I just dragged/dropped DataSet onto form which uses OLE DB provider against free foxpro table. All code wizard generated.
>Foxpro table does have a candidate key which was recognized as a primary key. Nulls in fields transformed to empty , no exception thrown in properties. There was no problem to add a record , but updating existing record causes an exception after pressing save button on a toolstrip ( not primary key updated , but shouldn't matter ). Wizard didn't create any statement for update ( None ) , but I guess , it is also expected. Any idea how to overcome that without writing any ( or minimal ) code. Exception stack is below.
>
>TIA
>Michael
>
>
>
>
>System.InvalidOperationException was unhandled
> Message="Update requires a valid UpdateCommand when passed DataRow collection with modified rows."
> Source="System.Data"
> StackTrace:
> at System.Data.Common.DbDataAdapter.UpdatedRowStatusErrors(RowUpdatedEventArgs rowUpdatedEvent, BatchCommandInfo[] batchCommands, Int32 commandCount)
> at System.Data.Common.DbDataAdapter.UpdatedRowStatus(RowUpdatedEventArgs rowUpdatedEvent, BatchCommandInfo[] batchCommands, Int32 commandCount)
> at System.Data.Common.DbDataAdapter.Update(DataRow[] dataRows, DataTableMapping tableMapping)
> at System.Data.Common.DbDataAdapter.UpdateFromDataTable(DataTable dataTable, DataTableMapping tableMapping)
> at System.Data.Common.DbDataAdapter.Update(DataTable dataTable)
> at WebMonitoring.mon_DataSetTableAdapters.monitoring_urlTableAdapter.Update(monitoring_urlDataTable dataTable) in C:\Tariffwise\WebMonitoring\mon_DataSet.Designer.cs:line 817
> at WebMonitoring.UrlBrowser.monitoring_urlBindingNavigatorSaveItem_Click(Object sender, EventArgs e) in C:\Tariffwise\WebMonitoring\UrlBrowser.cs:line 22
> at System.Windows.Forms.ToolStripItem.RaiseEvent(Object key, EventArgs e)
> at System.Windows.Forms.ToolStripButton.OnClick(EventArgs e)
> at System.Windows.Forms.ToolStripItem.HandleClick(EventArgs e)
> at System.Windows.Forms.ToolStripItem.HandleMouseUp(MouseEventArgs e)
> at System.Windows.Forms.ToolStripItem.FireEventInteractive(EventArgs e, ToolStripItemEventType met)
> at System.Windows.Forms.ToolStripItem.FireEvent(EventArgs e, ToolStripItemEventType met)
> at System.Windows.Forms.ToolStrip.OnMouseUp(MouseEventArgs mea)
> at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
> at System.Windows.Forms.Control.WndProc(Message& m)
> at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
> at System.Windows.Forms.ToolStrip.WndProc(Message& m)
> at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
> at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
> at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
> at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
> at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
> at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
> at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
> at System.Windows.Forms.Application.Run(Form mainForm)
> at WebMonitoring.URLManager.Main() in C:\Tariffwise\WebMonitoring\Program.cs:line 20
> at System.AppDomain.nExecuteAssembly(Assembly assembly, String[] args)
> at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
> at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
> at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
> at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
> at System.Threading.ThreadHelper.ThreadStart()


The wizard does not generate the update code for VFP tables. You need to manually enter the update statement to the tableadapter's UpdateCommand. You can do this from the DataSet designer by selecting the data table's tableAdapter and viewing the properties. From there select the UpdateCommand group and enter your update command in the CommandText property. Remember that parameters for non-SQL server tables like VFP are identified by using the ? instead of @fieldname.
Michael McLain
Previous
Reply
Map
View

Click here to load this message in the networking platform