Hitmanpt Posted October 4, 2012 at 07:06 PM Report #477791 Posted October 4, 2012 at 07:06 PM Boas pessoal... Bem eu tenho este código Dim command As New OleDb.OleDbCommand("INSERT INTO [admin] (username, password) VALUES (@usr, @pw)", con) command.Parameters.AddWithValue("@usr", Trim(TextBox1.Text)) command.Parameters.AddWithValue("@pw", pw) command.ExecuteNonQuery() con.Close() Simples... e é tudo strings... Mas dá-me este erro... Syntax error in INSERT INTO statement. Não precebo :X eu utilizo esta sintaxe para outra parte do programa e funciona 5* Mais detalhado o erro A first chance exception of type 'System.Data.OleDb.OleDbException' occurred in System.Data.dll System.Transactions Critical: 0 : <TraceRecord xmlns="http://schemas.microsoft.com/2004/10/E2ETraceEvent/TraceRecord" Severity="Critical"><TraceIdentifier>http://msdn.microsoft.com/TraceCodes/System/ActivityTracing/2004/07/Reliability/Exception/Unhandled</TraceIdentifier><Description>Exceção não processada</Description><AppDomain>BibliotecaEscolar-contagemdeentradas.vshost.exe</AppDomain><Exception><ExceptionType>System.Data.OleDb.OleDbException, System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</ExceptionType><Message>Syntax error in INSERT INTO statement.</Message><StackTrace> em System.Data.OleDb.OleDbCommand.ExecuteCommandTextErrorHandling(OleDbHResult hr) em System.Data.OleDb.OleDbCommand.ExecuteCommandTextForSingleResult(tagDBPARAMS dbParams, Object& executeResult) em System.Data.OleDb.OleDbCommand.ExecuteCommandText(Object& executeResult) em System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior behavior, String method) em System.Data.OleDb.OleDbCommand.ExecuteNonQuery() em WindowsApplication1.viewdata.Button2_Click(Object sender, EventArgs e) em D:\BibliotecaEscolar-contagemdeentradas\BibliotecaEscolar-contagemdeentradas\viewdata.vb:line 188 em System.Windows.Forms.Button.onmouseup(MouseEventArgs mevent) em System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks) em System.Windows.Forms.Control.WndProc(Message& m) em System.Windows.Forms.ButtonBase.WndProc(Message& m) em System.Windows.Forms.Button.WndProc(Message& m) em System.Windows.Forms.Nativewindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) em System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg) em System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData) em System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context) em System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context) em Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun() em Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel() em Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine) em WindowsApplication1.My.MyApplication.Main(String[] Args) em 17d14f5c-a337-4978-8281-53493378c1071.vb:line 81 em System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args) em Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() em System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) em System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) em System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) em System.Threading.ThreadHelper.ThreadStart()</StackTrace><ExceptionString>System.Data.OleDb.OleDbException (0x80040E14): Syntax error in INSERT INTO statement. em System.Data.OleDb.OleDbCommand.ExecuteCommandTextErrorHandling(OleDbHResult hr) em System.Data.OleDb.OleDbCommand.ExecuteCommandTextForSingleResult(tagDBPARAMS dbParams, Object& executeResult) em System.Data.OleDb.OleDbCommand.ExecuteCommandText(Object& executeResult) em System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior behavior, String method) em System.Data.OleDb.OleDbCommand.ExecuteNonQuery() em WindowsApplication1.viewdata.Button2_Click(Object sender, EventArgs e) em D:\BibliotecaEscolar-contagemdeentradas\BibliotecaEscolar-contagemdeentradas\viewdata.vb:line 188 em System.Windows.Forms.Button.onmouseup(MouseEventArgs mevent) em System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks) em System.Windows.Forms.Control.WndProc(Message& m) em System.Windows.Forms.ButtonBase.WndProc(Message& m) em System.Windows.Forms.Button.WndProc(Message& m) em System.Windows.Forms.Nativewindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) em System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg) em System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData) em System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context) em System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context) em Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun() em Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel() em Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine) em WindowsApplication1.My.MyApplication.Main(String[] Args) em 17d14f5c-a337-4978-8281-53493378c1071.vb:line 81 em System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args) em Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() em System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) em System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) em System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) em System.Threading.ThreadHelper.ThreadStart()</ExceptionString></Exception></TraceRecord>
Solution bioshock Posted October 4, 2012 at 07:57 PM Solution Report #477797 Posted October 4, 2012 at 07:57 PM https://wiki.portugal-a-programar.pt/dev_net/vb.net/access/ 1 Report
Hitmanpt Posted October 4, 2012 at 09:48 PM Author Report #477808 Posted October 4, 2012 at 09:48 PM Em 04/10/2012 às 21:57, bioshock disse: https://wiki.portugal-a-programar.pt/dev_net/vb.net/access/ Brigado 😉 Ajudou bastante
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now