How to Duplicate Records in a Datagrid based on the quantity field
Posted on 2006-07-21
I have an ASP.NET/VB.NET/MS SQL Web Application.
I am trying to do the opposite of a DISTINCT keyword.
Is there a way, via ADO .NET, to explode records that have a quantity field (with qty > 1).
If the quantity > 1 then I want to duplicate an exact copy of the record, up to the number in the quantity field, and change the quantity for each record to 1. The records will be duplicated within the datagrid based on the quantity;
I do not wat to save any record into database. I just want to display them in a Datagrid exploded by quantity.
I know in SQL it's pretty much impossible to do it. But I know it possible to implement the logic from code behind, please help.
Just t be more explicit here's the Products table structure.
Using ADO .NET DataSet I would like to display the products items to end up like this in a datagrid: