alsh3lan Level: Trainee
 Registered: 03-03-2009 Posts: 1
|
error - SavInto.ExecuteNonQuery()
hi all i have this problem that i don't know how to fix
this is the code in vb.net 2008 :
--------------------------------------
Dim n As String = Label16.Text
Dim SavInto As New OleDb.OleDbCommand
Dim ConStr As String = _
"Provider=Microsoft.Jet.OLEDB.4.0; Data Source =" & _
Application.StartupPath & "\data\MyData.Mdb;Jet OLEDB: Database Password=alsh1023;"
Dim Conn As New OleDbConnection(ConStr)
SavInto.Connection = Conn
SavInto.CommandType = CommandType.Text
'TextBox1.Text = MaskedTextBox1.Text
SavInto.CommandText = "UPDATE login SET user = '" & Trim(TextBox12.Text) & "', pass = '" & Trim(TextBox11.Text) & "' WHERE user ='" & n & "'"
Conn.Open()
SavInto.ExecuteNonQuery()
Conn.Close()
MsgBox("DATA SUCCESSFULLY UPDATED IN THE DATABASE")
'''''''''''''''''''''''''''''''''
End If
--------------------------------------
** (user) is primer key in database **
-------------------------------------
error:
Syntax error in UPDATE statement.
System.Data.OleDb.OleDbException was unhandled
ErrorCode=-2147217900
Message="Syntax error in UPDATE statement."
Source="Microsoft JET 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 CYTOGENETICS_UNIT.USERS.SAVER() in D:\KHALID-ANAYSIS\KHALID-ANALYSIS\KHALID-ANALYSIS\USERS.vb:line 227 at CYTOGENETICS_UNIT.USERS.Button7_Click(Object sender, EventArgs e) in D:\KHALID-ANAYSIS\KHALID-ANALYSIS\KHALID-ANALYSIS\USERS.vb:line 202 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(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 CYTOGENETICS_UNIT.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 System.Activator.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:
[Edited by alsh3lan on 03-03-2009 at 03:48 PM GMT]
____________________________
alsh3lan
|