473,394 Members | 1,813 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

SQL syntax error in INSERT INTO statement

When trying to submit data to an Access database using ASP.NET I recieve the
following error:

[OleDbException (0x80040e14): Syntax error in INSERT INTO statement.]
System.Data.OleDb.OleDbCommand.ExecuteCommandTextE rrorHandling(Int32 hr)
+41
System.Data.OleDb.OleDbCommand.ExecuteCommandTextF orSingleResult(tagDBPARAMS
dbParams, Object& executeResult) +174
System.Data.OleDb.OleDbCommand.ExecuteCommandText( Object& executeResult)
+92
System.Data.OleDb.OleDbCommand.ExecuteCommand(Comm andBehavior behavior,
Object& executeResult) +65
System.Data.OleDb.OleDbCommand.ExecuteReaderIntern al(CommandBehavior
behavior, String method) +112
System.Data.OleDb.OleDbCommand.ExecuteNonQuery() +66
PAPresenters.register.btnSubmit_Click(Object sender, EventArgs e) in
c:\inetpub\wwwroot\PAPresenters\register.aspx.vb:2 20
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +108
System.Web.UI.WebControls.Button.System.Web.UI.IPo stBackEventHandler.RaisePostBackEvent(String
eventArgument) +57
System.Web.UI.Page.RaisePostBackEvent(IPostBackEve ntHandler
sourceControl, String eventArgument) +18
System.Web.UI.Page.RaisePostBackEvent(NameValueCol lection postData) +33
System.Web.UI.Page.ProcessRequestMain() +1292

The SQL in the CommandText property immediately before the the
ExecuteNonQuery method, which I got using Visual Studio's debugger, are:
Debug.Print cmdSubmitToDB.CommandText


"INSERT INTO members
(organization,address1,city,state,zip,county,cell, email,password,membertype)
VALUES('Nate''s House','1234 My
House','MyCity','CA','12345','NONE','123-456-7890','n*********@hotmail.com','mypassword','artis tagent')"
What is wrong with the syntax in this statement? Is there any way I can have
be told where in the statement the error is? Thanks.
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/
Nov 19 '05 #1
3 2475
hi,
use [password] instead of password in the insert statement since password is
a reserved keyword.

--
The best
srini
http://www.expertszone.com
"Nathan Sokalski" wrote:
When trying to submit data to an Access database using ASP.NET I recieve the
following error:

[OleDbException (0x80040e14): Syntax error in INSERT INTO statement.]
System.Data.OleDb.OleDbCommand.ExecuteCommandTextE rrorHandling(Int32 hr)
+41
System.Data.OleDb.OleDbCommand.ExecuteCommandTextF orSingleResult(tagDBPARAMS
dbParams, Object& executeResult) +174
System.Data.OleDb.OleDbCommand.ExecuteCommandText( Object& executeResult)
+92
System.Data.OleDb.OleDbCommand.ExecuteCommand(Comm andBehavior behavior,
Object& executeResult) +65
System.Data.OleDb.OleDbCommand.ExecuteReaderIntern al(CommandBehavior
behavior, String method) +112
System.Data.OleDb.OleDbCommand.ExecuteNonQuery() +66
PAPresenters.register.btnSubmit_Click(Object sender, EventArgs e) in
c:\inetpub\wwwroot\PAPresenters\register.aspx.vb:2 20
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +108
System.Web.UI.WebControls.Button.System.Web.UI.IPo stBackEventHandler.RaisePostBackEvent(String
eventArgument) +57
System.Web.UI.Page.RaisePostBackEvent(IPostBackEve ntHandler
sourceControl, String eventArgument) +18
System.Web.UI.Page.RaisePostBackEvent(NameValueCol lection postData) +33
System.Web.UI.Page.ProcessRequestMain() +1292

The SQL in the CommandText property immediately before the the
ExecuteNonQuery method, which I got using Visual Studio's debugger, are:
Debug.Print cmdSubmitToDB.CommandText


"INSERT INTO members
(organization,address1,city,state,zip,county,cell, email,password,membertype)
VALUES('Nate''s House','1234 My
House','MyCity','CA','12345','NONE','123-456-7890','n*********@hotmail.com','mypassword','artis tagent')"
What is wrong with the syntax in this statement? Is there any way I can have
be told where in the statement the error is? Thanks.
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/

Nov 19 '05 #2
On Thu, 30 Jun 2005 23:48:02 -0700, "srini" <sr***@discussions.microsoft.com> wrote:

¤ hi,
¤ use [password] instead of password in the insert statement since password is
¤ a reserved keyword.

Sure is. You can always check the links below should you have any doubts:

List of Microsoft Jet 4.0 reserved words
http://support.microsoft.com/default...b;en-us;321266

List of reserved words in Access 2002 and Access 2003
http://support.microsoft.com/default...b;en-us;286335

ODBC Reserved Keywords
http://msdn.microsoft.com/library/de...d_keywords.asp
Paul
~~~~
Microsoft MVP (Visual Basic)
Nov 19 '05 #3
Right and better yet setup a Parameter-driven Command instead of using ad
hoc queries--unless you don't care about SQL injection and a number of other
issues.

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
www.betav.com/blog/billva
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________

"srini" <sr***@discussions.microsoft.com> wrote in message
news:E1**********************************@microsof t.com...
hi,
use [password] instead of password in the insert statement since password
is
a reserved keyword.

--
The best
srini
http://www.expertszone.com
"Nathan Sokalski" wrote:
When trying to submit data to an Access database using ASP.NET I recieve
the
following error:

[OleDbException (0x80040e14): Syntax error in INSERT INTO statement.]
System.Data.OleDb.OleDbCommand.ExecuteCommandTextE rrorHandling(Int32
hr)
+41

System.Data.OleDb.OleDbCommand.ExecuteCommandTextF orSingleResult(tagDBPARAMS
dbParams, Object& executeResult) +174
System.Data.OleDb.OleDbCommand.ExecuteCommandText( Object&
executeResult)
+92
System.Data.OleDb.OleDbCommand.ExecuteCommand(Comm andBehavior
behavior,
Object& executeResult) +65
System.Data.OleDb.OleDbCommand.ExecuteReaderIntern al(CommandBehavior
behavior, String method) +112
System.Data.OleDb.OleDbCommand.ExecuteNonQuery() +66
PAPresenters.register.btnSubmit_Click(Object sender, EventArgs e) in
c:\inetpub\wwwroot\PAPresenters\register.aspx.vb:2 20
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +108

System.Web.UI.WebControls.Button.System.Web.UI.IPo stBackEventHandler.RaisePostBackEvent(String
eventArgument) +57
System.Web.UI.Page.RaisePostBackEvent(IPostBackEve ntHandler
sourceControl, String eventArgument) +18
System.Web.UI.Page.RaisePostBackEvent(NameValueCol lection postData)
+33
System.Web.UI.Page.ProcessRequestMain() +1292

The SQL in the CommandText property immediately before the the
ExecuteNonQuery method, which I got using Visual Studio's debugger, are:
>Debug.Print cmdSubmitToDB.CommandText


"INSERT INTO members
(organization,address1,city,state,zip,county,cell, email,password,membertype)
VALUES('Nate''s House','1234 My
House','MyCity','CA','12345','NONE','123-456-7890','n*********@hotmail.com','mypassword','artis tagent')"
What is wrong with the syntax in this statement? Is there any way I can
have
be told where in the statement the error is? Thanks.
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/

Nov 19 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Gérard Leclercq | last post by:
ACCESS First fields are TEXT, last 2 are Numbers The name of the fields are correct. Dim MyConn Set MyConn=Server.CreateObject("ADODB.Connection") MyConn.Open...
4
by: dcarson | last post by:
I've read about this error in several other discussions, but still can't seem to pinpoint the problem with my code. Everything seemed to be working fine for some time, but it now tends to bomb out...
3
by: William | last post by:
i am using a dataset and a DataAdapter to update a table with the following schema: ResourceID ProjectID LastName FirstName Year Nov Dec Jan
7
by: kosta | last post by:
hello! one of my forms communicates with a database, and is supposed to add a row to a table using an Insert statement... however, I get a 'oledb - syntax error' exception... I have double...
2
by: eric dugal | last post by:
Hi all!! I need your help.... i'm working since 2 hours on a simple insert statement, but couldn't handle it. Here is my code : public int ExecQuery(string SqlString) {
3
by: Neil Zanella | last post by:
Hello, I am trying to execute ADO.NET INSERT statement where one of the fields is coming from a password HTML control. When I access the text with password.Value and print with Response.Write...
5
by: amitbadgi | last post by:
Hi guys, I am getting the following error in teh insert statement , I am converting this asp application to asp.net, here is teh error, Exception Details:...
2
by: RSH | last post by:
I have a rather simple script that transfers data from a SQL server database to an Access database. The procedure is intended to be dynamic so I am basically adding a datarow and then passing the...
6
by: ewpatton | last post by:
Good day, I've been trying to work with SQL and an Access database in order to handle custom user profiles. I haven't had any trouble reading from my database, but inserting new entries into...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.