468,510 Members | 1,755 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,510 developers. It's quick & easy.

Insert data into two table

Hi!

I have two tables in my database (userinfo, logininfo)

- userinfo table has five fields (uname, pws, con_pws, squest, sans)
- logininfo table has then six fields (fname,lname,dob,add1, add2, country)

I want to insert data in two tables (userinfo, logininfo) using this code:
Expand|Select|Wrap|Line Numbers
  1. <%sql1="insert into userinfo (uname, pws, con_pws, squest, sans) values ('"&uname&"','"&pws&"','"&con_pws&"','"&squest&"','"&sans&"');"
  2. my_conn.execute(sql)
  3.  
  4. sql2="insert into logininfo(fname,lname,dob,add1, add2, country) values'"&fname&"','"&lname&"','"&dob&"','"&add1&"','"&add2&"','"&country&"')"
  5. my_conn.execute(sql2)
  6. %>
  7.  
error - syntax error in INSERT INTO


how i slow this problem............ ?

pls help me.... and give idea.

thanks,
susan
Mar 4 '10 #1
2 2754
GazMathias
200 Expert 100+
sql2 has a missing opening parenthesis so would produce "values'shivansusan'" instead of "values ('shivansusan'"

A simple SQL sensibility check would have saved you here:

Expand|Select|Wrap|Line Numbers
  1. response.write sql2
  2. response.end
  3. my_conn.execute(sql2)
  4.  
Gaz
Mar 9 '10 #2
jhardman
3,405 Expert 2GB
You need to post db questions in the appropriate db forum. PLEASE STOP POSTING YOUR DB QUESTIONS IN THE ASP FORUM.

Jared
Mar 11 '10 #3

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

9 posts views Thread by Martin | last post: by
6 posts views Thread by pk | last post: by
16 posts views Thread by Philip Boonzaaier | last post: by
16 posts views Thread by robert | last post: by
6 posts views Thread by efgh | last post: by
reply views Thread by Christopher | last post: by
2 posts views Thread by Geoffrey KRETZ | last post: by
6 posts views Thread by rn5a | last post: by
reply views Thread by NPC403 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.