That's amusing! You need to extend you for loop and stop concatenating values onto you variables. If you run the debugger and look at the sql string you produce you'll see what's happening.
Code should be this:
for (int i = 0; i < lvProductInfo.Items.Count; i++)
{
ProductCode = Convert.ToInt32(lvProductInfo.Items[i].SubItems[1].Text);
ProductQuantity = Convert.ToInt32(lvProductInfo.Items[i].SubItems[2].Text);
ProductPrice = Convert.ToInt32(lvProductInfo.Items[i].SubItems[3].Text);
totalPrice = Convert.ToInt32(lvProductInfo.Items[i].SubItems[4].Text);
sql = "";
sql = "INSERT INTO PurchaseLog (ProductCode,ProductQuantity,ProductPrice,TotalPrice)"
+ " VALUES ('" + ProductCode + "','" + ProductQuantity + "','" + ProductPrice + "','" + totalPrice + "')";
clsConnection clsCn = new clsConnection();
SqlConnection cn = null;
SqlCommand cmd = new SqlCommand();
clsCn.fnc_ConnectToDB(ref cn);
cmd.Connection = cn;
cmd.CommandText = sql;
cmd.ExecuteNonQuery();
this.Close();
}
}
Note no more "+=" and you add the ListViewItems one by one.