ASP Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreASP Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old September 4th, 2003, 06:35 PM
spworld spworld is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Posts: 20 spworld User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Syntax Error (I think ) --->Please try to help

Can you please find out where is the error .I'm stuck in this simple
error which I don't know !


emailaddress = Request.Form("email")
sql= "INSERT INTO mlist (id,email) VALUES ('','"& emailaddress "')"

Reply With Quote
  #2  
Old September 4th, 2003, 06:47 PM
unatratnag unatratnag is offline
Average Intelligence
Dev Shed Novice (500 - 999 posts)
 
Join Date: Apr 2003
Location: Ohio/Chicago
Posts: 678 unatratnag User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 10 m 22 sec
Reputation Power: 6
Send a message via AIM to unatratnag
you're probably getting an error on the insert for the ID if it's not allowing nulls. If you have an autoincrementing number as the primary key do this

sql= "INSERT INTO mlist (email) VALUES ('"& emailaddress "')"

Reply With Quote
  #3  
Old September 5th, 2003, 06:45 AM
spworld spworld is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Posts: 20 spworld User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Hi unatratnag,
Thanks for replying ,
I tried using your approach but it didn't work .Yes ,the id is an auto number.My aim was to copy the entries of the form to a table in the database.I hope anyone can help .

Thanks in advance,

Reply With Quote
  #4  
Old September 5th, 2003, 06:52 AM
roninblade's Avatar
roninblade roninblade is offline
// no comment
Dev Shed Intermediate (1500 - 1999 posts)
 
Join Date: Dec 2001
Posts: 1,639 roninblade User rank is Sergeant Major (2000 - 5000 Reputation Level)roninblade User rank is Sergeant Major (2000 - 5000 Reputation Level)roninblade User rank is Sergeant Major (2000 - 5000 Reputation Level)roninblade User rank is Sergeant Major (2000 - 5000 Reputation Level)roninblade User rank is Sergeant Major (2000 - 5000 Reputation Level)roninblade User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 3 Days 4 h 45 m
Reputation Power: 33
dont put the id in the query if its an auto number.

Reply With Quote
  #5  
Old September 5th, 2003, 06:58 AM
spworld spworld is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Posts: 20 spworld User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
I tried not putting it but the problem is still there .Is there any syntax error in the expression :
sql= "INSERT INTO mlist (email) VALUES ('"& emailaddress "')"

knowing that 'emailaddress' is a VBscript variable carring the form input .

Reply With Quote
  #6  
Old September 5th, 2003, 07:05 AM
roninblade's Avatar
roninblade roninblade is offline
// no comment
Dev Shed Intermediate (1500 - 1999 posts)
 
Join Date: Dec 2001
Posts: 1,639 roninblade User rank is Sergeant Major (2000 - 5000 Reputation Level)roninblade User rank is Sergeant Major (2000 - 5000 Reputation Level)roninblade User rank is Sergeant Major (2000 - 5000 Reputation Level)roninblade User rank is Sergeant Major (2000 - 5000 Reputation Level)roninblade User rank is Sergeant Major (2000 - 5000 Reputation Level)roninblade User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 3 Days 4 h 45 m
Reputation Power: 33
i didn't see it at first, but, yes you dont have an ampersand "&" after emailaddress

Reply With Quote
  #7  
Old September 5th, 2003, 11:32 AM
Doug G Doug G is offline
Grumpier Old Moderator
Dev Shed God 12th Plane (10500 - 10999 posts)
 
Join Date: Jun 2003
Posts: 10,959 Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level) 
Time spent in forums: 1 Month 1 Day 15 h 59 m 14 sec
Reputation Power: 802
Try a debug response.write emailaddress to see if there is a value. If emailaddress is empty for some reason you'll get a syntax error.

Reply With Quote
  #8  
Old September 5th, 2003, 02:50 PM
spworld spworld is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Posts: 20 spworld User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Hi Doug G,
I didn't know how to debug the code.What program can I use?
OH god,I'm really stuck in this problem.Can anybody refer me to examples where inputs of a from are sent to mysql database?That's What I need .
Thanks,

Reply With Quote
  #9  
Old September 5th, 2003, 03:35 PM
Doug G Doug G is offline
Grumpier Old Moderator
Dev Shed God 12th Plane (10500 - 10999 posts)
 
Join Date: Jun 2003
Posts: 10,959 Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level) 
Time spent in forums: 1 Month 1 Day 15 h 59 m 14 sec
Reputation Power: 802
First, as roninblade said, edit this line to

sql= "INSERT INTO mlist (email) VALUES ('"& emailaddress & "')"

Right above this line for debugging you can add a line:

response.write "email address variable is: " & emailaddress & "<br />"

This will show the value for email address in your browser and you can then see if it's right or not.

Reply With Quote
  #10  
Old September 5th, 2003, 03:42 PM
spworld spworld is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Posts: 20 spworld User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Thank you roninblade
Thank you Doug G,
Thank you all .My code worked finally .Forgive me if I asked too much .I'm learning .We're all learning.

Reply With Quote
  #11  
Old September 6th, 2003, 11:25 AM
unatratnag unatratnag is offline
Average Intelligence
Dev Shed Novice (500 - 999 posts)
 
Join Date: Apr 2003
Location: Ohio/Chicago
Posts: 678 unatratnag User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 10 m 22 sec
Reputation Power: 6
Send a message via AIM to unatratnag
ouch... left out of the thank yous again.. that hurts

debugging is not a program or anything.. Just before you're getting errors do stuff like, print out the line to see if it's what you think it is. as for constructing SQL strings....
If you're knew, the first thing to learn is SQL when working with a database. If you try and work strait from ASP you'll confuse yourself. Get your lines working first in the DB command prompt. If you know you can't insert a value for a primary key because it's autoincremeint, you should open up your mysql and run queries till you figure out a working query, in this case
Code:
INSERT INTO mlist (email) VALUES ('test@devshed.com')

that works perfect. THe next step would be to make this an asp string. And you know how to concatenate strings right? with an &. So what value in this line needs to be dynamic? the email address of course. so pull that out and stick a variable in, easiest thing to do is to just do this
Code:
starting SQL line
INSERT INTO mlist (email) VALUES ('test@devshed.com')

add surrounding quotes first
"INSERT INTO mlist (email) VALUES ('test@devshed.com')" 

delete variable(s)
"INSERT INTO mlist (email) VALUES ('')" 

add our string closings around variables
"INSERT INTO mlist (email) VALUES ('" "')" 

add ampersands in
"INSERT INTO mlist (email) VALUES ('" & & "')" 

add variable
"INSERT INTO mlist (email) VALUES ('" & emailvariable & "')" 


good luck with getting the hang of it.

Reply With Quote
  #12  
Old September 6th, 2003, 02:16 PM
spworld spworld is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Posts: 20 spworld User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Thank you too unatratnag,
It's really a great work.You gave me a really good tutorial .I'm a beginner who is trying to explore the beauty of interactive languages and their relation with database.I'm now building my knowledge to be ready for the future .

Thank you all ...

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreASP Programming > Syntax Error (I think ) --->Please try to help


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support |