num = num + 1;
qty = Convert.ToInt32(QtyTb.Text);
totprice = qty * uprice;
Add these lines here
DataTable table = new DataTable();
table.Columns.Add("Num", typeof(int));
table.Columns.Add("Product", typeof(string));
table.Columns.Add("qty", typeof(int));
table.Columns.Add("uprice", typeof(int));
table.Columns.Add("totprice", typeof(int));
then continue your code
table.Rows.Add(num,product,qty,uprice,totprice);
OrdersGv.DataSource = table;
flag = 0;