I have a datagrid linked to tableadapter that is using a stored procedure to find records (start date and end date are passed up). Works like a champ, but I cannot seem to find a way to save changes made to the datagrid data.
Me.TblReceiveTableAdapter.Update(DataSet1)
When I make a change (I am using enter as my event) I get a message that “Update requires a valid UpdateCommand when passed DataRow collection with modified rows.
The entire message to the clipboard reads:
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(DataSet dataSet, String srcTable) at NewViewReceive.DataSet1TableAdapters.tblReceiveTableAdapter.Update(DataSet1 dataSet) in C:\Documents and Settings\brucee05\My Documents\Visual Studio 2008\NewestKeep\NewViewReceive\NewViewReceive\DataSet1.Designer.vb:line 1273 at NewViewReceive.frmViewReceive.TblReceiveDataGridView_CellContentClick(Object sender, DataGridViewCellEventArgs e) in C:\Documents and Settings\brucee05\My Documents\Visual Studio 2008\NewestKeep\NewViewReceive\NewViewReceive\Form1.vb:line 87 at System.Windows.Forms.DataGridView.OnCellEnter(DataGridViewCellEventArgs e) at System.Windows.Forms.DataGridView.OnCellEnter(DataGridViewCell& dataGridViewCell, Int32 columnIndex, Int32 rowIndex) at System.Windows.Forms.DataGridView.SetCurrentCellAddressCore(Int32 columnIndex, Int32 rowIndex, Boolean setAnchorCellAddress, Boolean validateCurrentCell, Boolean throughMouseClick) at System.Windows.Forms.DataGridView.ProcessDownKeyInternal(Keys keyData, Boolean& moved) at System.Windows.Forms.DataGridView.ProcessEnterKey(Keys keyData) at System.Windows.Forms.DataGridView.ProcessDataGridViewKey(KeyEventArgs e) at System.Windows.Forms.DataGridView.OnKeyDown(KeyEventArgs e) at System.Windows.Forms.Control.ProcessKeyEventArgs(Message& m) at System.Windows.Forms.DataGridView.ProcessKeyEventArgs(Message& m) at System.Windows.Forms.Control.ProcessKeyMessage(Message& m) at System.Windows.Forms.Control.WmKeyChar(Message& m) at System.Windows.Forms.Control.WndProc(Message& m) at System.Windows.Forms.DataGridView.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(ApplicationContext context) at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun() at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel() at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine) at NewViewReceive.My.MyApplication.Main(String[] Args) in 17d14f5c-a337-4978-8281-53493378c1071.vb:line 81 at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args) at System.AppDomain.nExecuteAssembly(Assembly assembly, String[] args) at System.Runtime.Hosting.ManifestRunner.Run(Boolean checkAptModel) at System.Runtime.Hosting.ManifestRunner.ExecuteAsAssembly() at System.Runtime.Hosting.ApplicationActivator.CreateInstance(ActivationContext activationContext, String[] activationCustomData) at System.Runtime.Hosting.ApplicationActivator.CreateInstance(ActivationContext activationContext) at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssemblyDebugInZone() at System.Threading.ThreadHelper.ThreadStart_Context(Object state) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.ThreadHelper.ThreadStart()
InnerException:
I am new to vb 2008, and dragged the datagrid from the Data Sources window. When I set up the data source the Wizard results said that I had generated Select, Insert table mappings Fill, get and update.
Please help, where am I missing things?
Thanks,
Bruce