Hi All

My application uses a datagridview to allow a user to enter data to create new Companies, Employees etc.

The data entry happens on a datagridview. Some of the data entered is mandatory and some is optional. How do i loop through the datagrid view ensuring that at least all Mandatory information is supplied and then INSERT the data.
This is the datagridview structure:
Col(0) ID column
Col(1) Description Column ie Company Name
Col(3) Value Column ie "ABC Company"
Col(4) Optional / Mandatory indicator

The conditions that must be met to insert data are:
  • Col(0) must contain a value
  • If Col(4) is "Mandatory" Then Column 3 must have a value


The insert statement is very simple, its the firing of the insert statement based on the conditions for each row in the datagridview that is the issue.