ZAIN ULARIFEEN

ZAIN ULARIFEEN

  • 1.6k
  • 143
  • 150.5k

HOW TO SAVE MULTIPLE RECORDS FROM THE DATAGRIDVIEW INTO DB

Feb 12 2013 1:09 PM
I have a datagridview view that looks like this:
 
ProductId | Name | Price | Quantity
 
The datagridview starts with all cells empty.
 
The user will enter data in each of the columns. The number of products the user enters changes(is unknown). The user could enter only one product or five products.
 
So, once the user has entered all the products he has to enter, i want that when he clicks a button, all products will be saved to the database.
 
The table in the sql database looks like the datagrid:
 
ProductId | Name | Price | Quantity
 
As the number of products that the user will enter is unknown, how can I save the data to the database?

Answers (2)