search recode & insert or delete the following ?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Fary4u
    Contributor
    • Jul 2007
    • 273

    search recode & insert or delete the following ?

    Hi
    i've got the condition in asp & database that
    the product id holding multipule items values
    html checkbox already checked if value in the database but if not then it's unchecked
    & i'm gonna check that if it's already into the database
    then don't insert the value & if it's not then insert it but other condition is
    i'm taking user input from check box so if some body don't want to insert again then deleted the value from the database

    table values like this [code=asp]
    prod id | sizes
    1 | 1
    1 | 2
    1 | 4
    1 | 6
    1 | 7 [/code]

    like [code=asp]
    if size2 = "2" Then
    sqlText = "INSERT INTO PRODUCT_SIZES " _
    & " (size_id, prod_id) values " _
    & " ('2',"&prid&")"
    Conn.Execute(sq lText)
    else if size2 = "" <> Then
    sqlText = "Delete size_id, prod_id From Product_sizes Where prod_id=" & pds
    Conn.Execute(sq lText)
    end if
    [/code]
    question is how do i gona check the value 1st & then execute the code to insert & Delete ?
    coz i'm gonna do this in so many times
    can any body help in this ?
  • sonu5588
    New Member
    • Aug 2007
    • 13

    #2
    Fary how are u first I will Tell U that ur table is incorrect
    u have to create the right table .....


    create Tabel >>
    ID SIZE
    1 1
    2 2
    3 5
    4 10
    ur ID column should be a Incremental after insert one value or size
    the ID must be increment Automatically.. .

    first create this table ....

    and After that use this query for check it .......


    ("SELECT * from 'table name' where ID =" + Request.queryst ring)
    if u feel problem then mail me ur page on sonu5588@yahoo. com

    Comment

    Working...