|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now! |
|
#1
|
|||
|
|||
|
I have been messing with this code for a while now, and I need a fresh set of eyes to look at it. My DB table is set up with the exact number of colums, and in the insert order. I can insert username and username's value with everything else commented out, but as soon as I add the next field (password) it goes nutty.... below is the page of code followed by the output on the screen.
--------TAKE_REGISTRATION.ASP--------------------- p_userid = Request.QueryString("p_name") p_pass1 = Request.QueryString("p_pass1") p_pass2 = Request.QueryString("p_pass2") p_first = Request.QueryString("p_first") p_last = Request.QueryString("p_last") p_email = Request.QueryString("p_email") 'create the object set guilmetrpDB = Server.CreateObject ("ADODB.Connection") 'open the connection guilmetrpDB.Open strconn 'insert record here 'theSQL = "insert into members values('rxguil3', 'pass2', 'ron', 'guil', 'me.com')" theSQL = "insert into members " theSQL = theSQL & "(username, password, first_name, last_name, email)" theSQL = theSQL & " values ('"&p_userid&"','"&p_pass1&"', '"&p_first&"', '"&p_last&"', '"&p_email&"')" ' print to debug Response.Write theSQL guilmetrpDB.Execute theSQL 'close connection guilmetrpDB.Close 'destroy the connection set guilmetrpDB = Nothing ---------SCREEN SHOT---------------- insert into members (username, password, first_name, last_name, email) values ('rxguil','imouturn', 'ron', 'guilmet', 'me@me.com') Microsoft JET Database Engine error '80040e14' Syntax error in INSERT INTO statement. /take_registration.asp, line 27 ----------------------------------------------- any help would be nice, for my eyes are bleeding. |
|
#2
|
|||
|
|||
|
I think password is a reserved word. Try putting [ ] around it in your sql
theSQL = theSQL & "(username, [password], first_name, last_name, email)" |
|
#3
|
|||
|
|||
|
Have you tried removing password and just using the other four paramenters?
Also, you may want to print out the values of each parameter to ensur they are what you think they are. |
|
#4
|
|||
|
|||
|
I could be way off but try it like this:
theSQL = "INSERT INTO members (username, password, first_name, last_name, email) VALUES ('" & p_userid & "', '" & p_pass1 & "', '" & p_first & "', '" & p_last & "', '" & p_email & "')" and then like victorpendleton was saying do a response.write(theSQL) to see if your output is what you expect I also noticed that in your error message all the values have space after the comma except for the the first two, maybe this has something to do with the error. |
|
#5
|
|||
|
|||
|
Nevermind the [password] thing is definantly the reason, is just tried recreating a database and script that was very similar and I got an invalid syntax error then I put password in [] and the it wrote to the table just fine.
So that makes me wonder, if password is a reserved word, what is it reserved for ![]() |
|
#6
|
|||
|
|||
|
Quote:
I think there is an Access datatype called "password" |
|
#7
|
|||
|
|||
|
In my post I included the original code, and the "screen shot" code which shows that I print out also the sql statement to ensure my data is correct.
I also looked up if "Password" is a reserved word, and according to the documentation "Password" is not. However, I did change the Request.Querystring to Requset("p_name"), and it works now. The only thing I can think of is that maybe something dirty was in the querystring coming from the form, but I as you can see from the sql output (stated in the first post) there is no descrepency. Well the problem, what ever it was, seems to be fixed. Thanks again looking at the code... Ron |
|
#8
|
|||
|
|||
|
I don't see password in any list of reserved words for Access either, but I've had the same problem in the past and using the MS [ ] syntax fixed the problem for me too.
|
|
#9
|
|||
|
|||
|
Well you know, that is why we all love Access so much
|
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > ASP Programming > Syntax error in INSERT INTO statement. |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|