Two records with one ID!

Results 1 to 3 of 3

Thread: Two records with one ID!

  1. #1
    Me! Guest

    Default Two records with one ID!

    Hi,<BR>I have a form with two same list box(Category1 and Category2)and 6 other dropdown boxes. When a user selects one from each category and selects one item from each drop down boxes then in next page I entered all the 6 items into a table. I get the newrecordID and with category selection insert them into another table. If I select only one category then it is inserting fine but with two category item, it is always inserting the second one.<BR>Here is the code for second page:<BR><BR>&#039;Open the connection and create a recordset<BR>&#039;Get the user input and keep them in a variable<BR>&#039;Open the content table and insert the field name and values<BR>&#039;Get the newID (Upto this point it worked fine.)<BR>&#039;Get the category into two variables<BR>var1=Request.Form("CategoryName1")<BR >var2=Request.Form("CategoryName"2)<BR>If var1 &#060;&#062; "" AND var2= "" Then<BR> &#039;Open a recordset and open the main table<BR> rs.AddNew<BR> rs("ContentID")= ID (I got it after inserting into the content table)<BR> rs("CategoryID") = var1<BR> rs.Update<BR> Else<BR> rs("ContentID")=ID<BR> rs("CategoryID")= var2<BR> rs.Update<BR> rs.close<BR> Set rs= Nothing<BR> If var1 &#060;&#062; "" AND var2 &#060;&#062; "" Then<BR> rs.AddNew<BR> rs("ContentID")= ID<BR> rs("CategoryID") = var1<BR> rs("ContentID") = ID<BR> rs("CategoryID") = var2<BR> rs.Update<BR> Set rs= Nothing<BR><BR>Can somebody tell me how can insert two records with same contentID?<BR>It is very urgent. I will appreciate any help.<BR><BR>THANKS.<BR><BR> <BR>How can I have two records with One ID?<BR>

  2. #2
    CV Guest

    Default RE: Two records with one ID!

    instead of using if else in first condition use 2 if conditions<BR>If var1 &#060;&#062; "" then<BR>update<BR>end if<BR>If var2 &#060;&#062; "" then<BR>update<BR>end if<BR>this will work fine if u&#039;r id is not the primary key .

  3. #3
    Join Date
    Dec 1969
    Los Angeles, CA

    Default Has been solved...IGNORE <eop>


Posting Permissions

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