I have the following C# Code:
for (int i = 0; i < dgItems.Rows.Count - 1; i++)
{
SqlCommand cmd = new SqlCommand(@"INSERT INTO TBL_OrderQty (SipStyle,SipColor,SipSize,[SipQty(-%5)],SipQty,[SipQty(+%5)]) VALUES('" + dgItems.Rows[i].Cells[0].Value + "','" + dgItems.Rows[i].Cells[1].Value + "','" + dgItems.Rows[i].Cells[2].Value + "','" + dgItems.Rows[i].Cells[3].Value + "','" + dgItems.Rows[i].Cells[4].Value + "','" + dgItems.Rows[i].Cells[5].Value + "')", con);
con.Open();
cmd.ExecuteNonQuery();
con.Close();
progressBar1.Value = i;
LB_ProgText.Text = "Progress :%" + (i / 100) * dgItems.Rows.Count;
LB_ProgText.Invalidate();
LB_ProgText.Update();
}
I'm trying to show the progress percentage of the whole operation, the progress bar is working just fine but I couldn't get the percentage right; can you please help me.