Insert data into two table

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • shivasusan
    New Member
    • Oct 2008
    • 67

    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,do b,add1, add2, country)

    I want to insert data in two tables (userinfo, logininfo) using this code:
    Code:
    <%sql1="insert into userinfo (uname, pws, con_pws, squest, sans) values ('"&uname&"','"&pws&"','"&con_pws&"','"&squest&"','"&sans&"');"
    my_conn.execute(sql)
    
    sql2="insert into logininfo(fname,lname,dob,add1, add2, country) values'"&fname&"','"&lname&"','"&dob&"','"&add1&"','"&add2&"','"&country&"')"
    my_conn.execute(sql2)
    %>
    error - syntax error in INSERT INTO


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

    pls help me.... and give idea.

    thanks,
    susan
  • GazMathias
    Recognized Expert New Member
    • Oct 2008
    • 228

    #2
    sql2 has a missing opening parenthesis so would produce "values'shivans usan'" instead of "values ('shivansusan'"

    A simple SQL sensibility check would have saved you here:

    Code:
    response.write sql2
    response.end
    my_conn.execute(sql2)
    Gaz

    Comment

    • jhardman
      Recognized Expert Specialist
      • Jan 2007
      • 3405

      #3
      You need to post db questions in the appropriate db forum. PLEASE STOP POSTING YOUR DB QUESTIONS IN THE ASP FORUM.

      Jared

      Comment

      Working...