i have table in sql server 2000, in whicn i have coloums.
now on the interface i have one text box as customercode, and four (4)combo boxes with differnt values.
when user wants to do entry, he will enter any code, and will select values from combo boxes, and when user click on command button then in table the each combo box value should b stored on new row and code should b stored same on 4 rows.

RS2.Open "SELECT * from CUSTOMER_ATTRIBUTES", Module1.con, adOpenStatic,adLockOptimistic
RS2.AddNew

RS2.Fields("Customercode").Value = txtpartycode.Text

RS2.Fields("CC_ATTRIBUTE_ID").Value = Combo1.Text
RS2.Fields("CC_ATTRIBUTE_ID").Value = Combo2.Text
RS2.Fields("CC_ATTRIBUTE_ID").Value = Combo3.Text
RS2.Fields("CC_ATTRIBUTE_ID").Value = Combo4.Text

rs2.update

it only stores one last entry.when i want to store it as much combo box's value.

add rs.update after each combo box.

now it is adding just one uper value. not all...
its error is "Identity Can not be Determined For Newly Inserted Row."
and it is pointing to combo2.
where as i told u, with each combo value, the Customer code should also b stored on new row.
e.g

Customer Code        Combo Values.
157                  Gold       (Combo1 value)
157                  Silver     (Combo2 value)
157                  Diamond    (Combo3 value)
157                  Bronze.    (Combo4 value)
RS2.AddNew
RS2.Fields("Customercode").Value = txtpartycode.Text
RS2.Fields("CC_ATTRIBUTE_ID").Value = Combo1.Text
RS2.Update

RS2.AddNew
RS2.Fields("Customercode").Value = txtpartycode.Text
RS2.Fields("CC_ATTRIBUTE_ID").Value = Combo2.Text
RS2.Update

RS2.AddNew
RS2.Fields("Customercode").Value = txtpartycode.Text
RS2.Fields("CC_ATTRIBUTE_ID").Value = Combo3.Text
RS2.Update

RS2.AddNew
RS2.Fields("Customercode").Value = txtpartycode.Text
RS2.Fields("CC_ATTRIBUTE_ID").Value = Combo4.Text
RS2.Update

i have used this code and it is working very fine. but there is error coming in database table, where these values are stored.
"Key Coloum Information Is Insufficient or Incorrect.too many rows were affected by update".

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.