Checking if Record Exists

Results 1 to 2 of 2

Thread: Checking if Record Exists

  1. #1
    Join Date
    Dec 1969

    Default Checking if Record Exists

    If a record already exists, I want to update the quantity field by x-amount (which was gathered from a form). If the record does not exist, I want to create it. How do I do this?<BR><BR>Cheers, Alfred Low.

  2. #2
    Join Date
    Dec 1969

    Default What is the "Where" clause to check for

    the existence of the record, how do you check if the record exists, in other words what is the primary key on which you would check for the record in the table.<BR><BR>OK lets say that key is username:<BR>set rs = conn.execute("select username from tablename where username = &#039;" & request("uname") & "&#039;"<BR><BR>IF not rs.eof then &#039; record exists<BR>set rs = nothing<BR>set rs = conn.execute("update tablename set columnname = value where username = &#039;" & request("uname") & "&#039;"<BR><BR>ELSE<BR>set rs = nothing<BR>set rs = conn.execute("insert into ......")<BR><BR>END IF<BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts