471,071 Members | 962 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,071 software developers and data experts.

Insert data into two table


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)
  4. sql2="insert into logininfo(fname,lname,dob,add1, add2, country) values'"&fname&"','"&lname&"','"&dob&"','"&add1&"','"&add2&"','"&country&"')"
  5. my_conn.execute(sql2)
  6. %>
error - syntax error in INSERT INTO

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

pls help me.... and give idea.

Mar 4 '10 #1
2 2863
228 Expert 128KB
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)
Mar 9 '10 #2
3,406 Expert 2GB
You need to post db questions in the appropriate db forum. PLEASE STOP POSTING YOUR DB QUESTIONS IN THE ASP FORUM.

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

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.