ozzy

ozzy

  • NA
  • 13
  • 0

Inserting data to database from existing values

Mar 8 2010 11:19 AM
Hi,

I need to get some data from database and than insert them back just by changing 1 column's values. For example in my database I have A,B,C columns and 5 records. I want to get these 5 rows and change column B's values to some other value and insert them back as new rows (I don't want to update existing rows but I want to add them as new rows. So at the end I'll have total 10 rows in my database).
I'm trying to do that by using a gridcontrol, I don't have any problems with getting the data from database but I just can't figure out how to do what I want. 
I tried to do it by using a "for" loop and I was able to get and change column values but I put a gridview.AddNewRow command inside the for loop and this loop only adds one row and always updates that single row. However I want it to do the same changes for all 5 rows and add 5 new row.

Any idea how I can do that ???

Thanks.

Answers (6)