private int rowmax = 0;
Dgsplitdata.currentcell = dgsplitdata[0, 0];
String Tempstrsql;
Rowmax is the maximum line number in the current DataGridView
for (int i = Rowmax; Rowmax < dgSplitData.Rows.Count; rowmax++)
{
if (This.dgsplitdata.rows[rowmax]. Cells[0]. Value = = null)
{
Break
}
Else
{
String cargoconame = Dgsplitdata.rows[rowmax]. Cells[0]. Value.tostring (). Trim ();
String splitweight = Dgsplitdata.rows[rowmax]. CELLS[1]. Value.tostring (). Trim ();
String shipname = Dgsplitdata.rows[rowmax]. cells["ShipName"]. Value.tostring (). Trim ();
String column3 = Dgsplitdata.rows[rowmax]. cells["Column3"]. Value.tostring (). Trim ();
String remark = Dgsplitdata.rows[rowmax]. cells["Remark"]. Value.tostring (). Trim ();
String sendvalues = "('" + Cargoconame + "', '" + splitweight + "', '" + ShipName + "', '" + Column3 + "', '" + Remark + "')" ;
Tempstrsql = "INSERT into T_splitdata (Cargocompany,weight,shipname,commodity,remark) values" + sendvalues; App.updatedatabase (Tempstrsql);
}
DataGridView Data Loading