09-09-17, 01:05 PM
اذا اضفت where
الكود
وجربت اضيف بدل :
ومثل الشيء
كود :
System.Data.OleDb.OleDbException occurred
HResult=0x80040E14
Message=Syntax error in UPDATE statement.
Source=Microsoft Access Database Engine
StackTrace:
at System.Data.OleDb.OleDbCommand.ExecuteCommandTextErrorHandling(OleDbHResult hr)
at System.Data.OleDb.OleDbCommand.ExecuteCommandTextForSingleResult(tagDBPARAMS dbParams, Object& executeResult)
at System.Data.OleDb.OleDbCommand.ExecuteCommandText(Object& executeResult)
at System.Data.OleDb.OleDbCommand.ExecuteCommand(CommandBehavior behavior, Object& executeResult)
at System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior behavior, String method)
at System.Data.OleDb.OleDbCommand.ExecuteNonQuery()
at Rent_Schedule.Form2.Button3_Click(Object sender, EventArgs e) in D:\my project\Complete Project\Rent Schedule\Rent Schedule\Form2.vb:line 77
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 Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine)
at Rent_Schedule.My.MyApplication.Main(String[] Args) in :line 81الكود
كود :
Dim conn As New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=|DataDirectory|\Database1.accdb;Persist Security Info=False;")
Dim sql As String =
" update [Customer] set " &
" ( Cus_Name=@Cus_Name, Cus_Address=@Cus_Address, Cus_Region=@Cus_Region, Cus_Telephone_Number=@Cus_Telephone_Number )" &
" where " &
"( Cus_ID=@Cus_ID )"
Dim cmd As New OleDbCommand(sql, conn)
cmd.Parameters.AddWithValue("@Cus_Name", TextBox1.Text)
cmd.Parameters.AddWithValue("@Cus_Address", TextBox3.Text)
cmd.Parameters.AddWithValue("@Cus_Region", TextBox4.Text)
cmd.Parameters.AddWithValue("@Cus_Telephone_Number", TextBox5.Text)
conn.Open()
cmd.ExecuteNonQuery()
conn.Close()
MessageBox.Show("We have been successfully Update", "Congratulations", MessageBoxButtons.OK, MessageBoxIcon.Information)
Form2_Load(e, e)كود :
Cus_IDكود :
Cus_Private_Numberومثل الشيء

