Simple ASP MYSQL question

Discussion in 'ASP General' started by Lawrence, Apr 30, 2007.

  1. Lawrence

    Lawrence Guest

    Hey

    I have successfully been able to read from a MYSQL database using
    this:

    set rs = conn.Execute("SELECT Password FROM UserTable WHERE Username =
    '" & entuser & "' AND Password = '" & entpass & "'")

    Do while not rs.eof ' Do until it reaches end of db
    actualpass = rs("Password")
    rs.MoveNext ' Next record
    loop


    But I now want to be able to add new records to tables, I used this
    code, but it does not seem to be able to work, any ideas?

    set rs = conn.Execute("INSERT INTO UserTable SET Username = '" &
    username & "' AND Password = '" & username & "' AND FirstName = '" &
    username & "' AND LastName = '" & username & "' AND Email = '" &
    username & "' AND confirm = 0 AND confstring = '" & passconf & "'")
     
    Lawrence, Apr 30, 2007
    #1
    1. Advertising

  2. Lawrence

    Evertjan. Guest

    Lawrence wrote on 30 apr 2007 in microsoft.public.inetserver.asp.general:

    > set rs = conn.Execute("INSERT INTO UserTable SET Username = '" &
    > username & "' AND Password = '" & username & "' AND FirstName = '" &
    > username & "' AND LastName = '" & username & "' AND Email = '" &
    > username & "' AND confirm = 0 AND confstring = '" & passconf & "'")
    >


    I am not a mySql specialist, but the AND's seem faulty.

    Try something like:

    SQL="INSERT INTO UserTable (Password , FirstName , LastName )"&_
    "VALUES ('" & pw & "','" & fn & "','" & ln & "')"
    response.write SQL
    response.end
    ' remark these 2 lines above when you are satisfied with the result
    set rs = conn.Execute(SQL)

    --
    Evertjan.
    The Netherlands.
    (Please change the x'es to dots in my emailaddress)
     
    Evertjan., Apr 30, 2007
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. JL
    Replies:
    0
    Views:
    1,178
  2. Ravi
    Replies:
    6
    Views:
    1,444
    Suchandra Thapa
    Jul 21, 2003
  3. Replies:
    2
    Views:
    6,251
  4. washakie
    Replies:
    4
    Views:
    955
    washakie
    Jan 15, 2008
  5. Jeffrey H. Coffield
    Replies:
    1
    Views:
    1,934
Loading...

Share This Page