In this form code, when a new appliance is added to the data view grid it is saved…
- User
In this form code, when a new appliance is added to the data view grid it is saved sucessfully both in the dataviewgrid and access database. but when an already existing appliance is deleted or edit the following error occurs: System.Data.OleDb.OleDbException: 'No value given for one or more required parameters.': System.Data.OleDb.OleDbException HResult=0x80040E10 Message=No value given for one or more required parameters. 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 ApplianceRental.AdminDashboardForm.saveButton_Click(Object sender, EventArgs e) in C:\Users\Kaddra52\source\repos\ApplianceRental\ApplianceRental\AdminDashboardForm.cs:line 75 at System.Windows.Forms.Control.OnClick(EventArgs e) at System.Windows.Forms.Button.OnClick(EventArgs e) at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent) at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks) at System.Windows.Forms.Control.WndProc(Message& m) at System.Windows.Forms.ButtonBase.WndProc(Message& m) at System.Windows.Forms.Button.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(IntPtr 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 ApplianceRental.Program.Main() in C:\Users\Kaddra52\source\repos\ApplianceRental\ApplianceRental\Program.cs:line 19
the error highlights the following line: sda.Update(dt);
find all my code below for reference and help locate and fix the error: using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using System.Data.OleDb; using System.IO; using System.Diagnostics;
namespace ApplianceRental { public partial class AdminDashboardForm : Form { OleDbDataAdapter sda; OleDbConnection con; DataTable dt; string connectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Path.Combine(AppDomain.CurrentDomain.BaseDirectory.Replace("bin\Debug\", ""), "db_users.mdb");
- Assistant
- User
same error occurs
- Assistant