wilsonf1 Posted March 13, 2007 Share Posted March 13, 2007 hi i want to use a form for people to submit their email addresses from my site - id also like the date of the submission redorded tooi can get it working when there is just one column named 'email' (and ofcourse id for key) and the address adds fine, when i try to add a second value it doesnthere is my working lines (with a database that just has email column):insertSQL = "INSERT INTO emails (email) VALUES ('" & emailadd & "'')"'response.Write(insertSQL)databaseConnection.Execute insertSQL, adLockPessimisticthis doesnt work (extra date column added) - with the errors being:Syntax error in INSERT INTO statement. ln 28.26 insertSQL = "INSERT INTO emails (email,date) VALUES ('" & emailadd & "','10')"27 'response.Write(insertSQL)28 databaseConnection.Execute insertSQL, adLockPessimisticive tried fiddling with that second value, im using 10 just as a simple example before trying to add the date variable, with quotes, without quotes, it just complains????????? Link to comment Share on other sites More sharing options...
wilsonf1 Posted March 13, 2007 Author Share Posted March 13, 2007 this may help, i unleashed the response.write - whats up with this!!:INSERT INTO emails (email,date) VALUES ('admin@enterf2.co.uk','13/03/2007')Microsoft JET Database Engine error '80040e14'Syntax error in INSERT INTO statement./mclaren-teamcasts-email2.asp, line 28 Link to comment Share on other sites More sharing options...
pulpfiction Posted March 13, 2007 Share Posted March 13, 2007 It must be some "reserved keywords" problem.... in that case you need to use such words within square brackets []. try this.... guessing reserved word must be "date" so, your query should be like this....INSERT INTO emails (email,[date]) VALUES ('admin@enterf2.co.uk','13/03/2007')code:insertSQL = "INSERT INTO emails (email,[date]) VALUES ('" & emailadd & "','10')" Link to comment Share on other sites More sharing options...
wilsonf1 Posted March 13, 2007 Author Share Posted March 13, 2007 i tried the square brackets and a new column name, the result:INSERT INTO emails (email,date_added) VALUES ('admin@enterf2.co.uk','13/03/2007')Microsoft JET Database Engine error '80040e07'Data type mismatch in criteria expression./mclaren-teamcasts-email2.asp, line 28 Link to comment Share on other sites More sharing options...
jesh Posted March 13, 2007 Share Posted March 13, 2007 Data type mismatch in criteria expression.Maybe it's the way you are passing the date. Many database management systems store dates in the YYYY/MM/dd format. Try this query:INSERT INTO emails (email,[date]) VALUES ('admin@enterf2.co.uk','2007/03/13') EDIT: Also try "2007-03-13". Link to comment Share on other sites More sharing options...
wilsonf1 Posted March 13, 2007 Author Share Posted March 13, 2007 thanks, but unfortunately whatever i put in the second value doesnt work, text, dates, numbers........ same old errorinsertSQL = "INSERT INTO emails (email,date_added) VALUES ('" & emailadd & "','hello')" Link to comment Share on other sites More sharing options...
pulpfiction Posted March 14, 2007 Share Posted March 14, 2007 Check you datatype of the "date_added" field, cos if its type is "date" then if you give string or number then it will give an error, also what database are you using? as jesh mentioned the date format might be different [eg: US format - mm/dd/yyyy] Link to comment Share on other sites More sharing options...
wilsonf1 Posted March 15, 2007 Author Share Posted March 15, 2007 its fixed!!!i cant believe it the data type was set to numbers, when i created the table i was just tabbing through creating the columns i never choose numbers!!thanks to all, you know i'll be back haha Link to comment Share on other sites More sharing options...
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