It would probably be better (easier or more efficient) to have the SQL
Server worry about and handle the repetitions, then all you need is for for
code to move through each value and fire it to the SQL Server (which would
be incredibly fast and easy to implement).
Basically on the SQL Server, you would write a stored procedure that takes
the integer input and checks if it already exists, if so it would increment
the quantity of that row. Otherwise it would insert a brand new row for that
integer.
Your code could then simply call the stored procedure for each integer in
the dataset.
Hope this helps.
Br,
Mark.
"Diego F." <di*******@terra.es> wrote in message
news:O5**************@TK2MSFTNGP09.phx.gbl...
Hi. I need to map items from a DataSet to a SQL table.
The problem is that in the DataSet I can have the same item repeted, but
in the table, I have a field "quantity" to avoid that. So what I need is a
structure where I get each item and the number of repetitions.
In the DataSet, I have one table and I only need to use one column, and
the items are integers, so the idea is passing from:
100 102 100 103 to
100 (2) 102 (1) 103 (1) or something like that.
I don't know if I can get something with the DataSet Select method. I
passed the column to an ArrayList, but I don't know if that simplifyes something.
Can you help me?
Regards,
Diego F.