Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Syntax error in INSERT INTO statement in ASP

Status
Not open for further replies.

craiogram

MIS
Feb 20, 2004
126
US
Sorry if I should've asked this elsewhere but b/c it's on my ASP page I'm starting here.

This works:
Code:
"INSERT INTO meltingPot(uname,fname,lname,email,password)" & _
		"Values('" & (Request.Form("uname")) & "'," & _
			"'" & (Request.Form("fname")) & "'," & _
			"'" & (Request.Form("lname")) & "'," & _
			"'" & (Request.Form("email")) & "'," & _
			"'" & Request.Form("pswd") & "')"

But this does NOT work:
Code:
"INSERT INTO meltingPot(uname,fname,lname,email,password,TimeStamp)" & _
	 "Values('" & (Request.Form("uname")) & "'," & _
			"'" & (Request.Form("fname")) & "'," & _
			"'" & (Request.Form("lname")) & "'," & _
			"'" & (Request.Form("email")) & "'," & _
			"'" & (Request.Form("pswd")) & "'," & _
			"'" & (now()) & "')"

I've also tried to do the response.write(query) and it looks fine. All the values show up. The table has the 5 cols. The 1st 4 are text and the 5th was date/time but I changed it to text as well to see if it would work but nothing.

Any help would be greatly appreciated.
Thank you much!
 
what database are you using? Encapsulation may be the problem

 
you said the table has 5 cols...but you are trying to insert 6 values...

-DNG
 
ms access needs dates surrounded by # # then

this one is in the FAQ and mentioned many of many times via the years here in the asp forum. Try using the search and FAQ sections prior to posting questions.

Thanks and hope that helps along with future trouble shooting

 
I apologize. I is 5 cols when it works in the 1st Insert but has 6 cols in the 2 Insert where it does NOT work.

thank you.
 
for oracle database you need to convert the date using to_date function.


to_date('"&now()&"','h24:mi:ss mm-dd-yyyy')

hope this helps

regards
Ron
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top