private void btnSaveChanges_Click(object sender, EventArgs e) { int rowCount; DataSet allProductData = new DataSet(); allProductData.ReadXml("Products.xml", XmlReadMode.ReadSchema); SmartMartClassLibrary.SmartMart Service = new SmartMartClassLibrary.SmartMart(); try { foreach (DataRow row in allProductData.Tables["Products"].Rows) if (int.Parse(row["Dirty"].ToString()) == 1) rowCount = Service.UpdateProducts(int.Parse(row["ProductID"].ToString()), row["BrandName"].ToString(), row["ProductName"].ToString(), double.Parse(row["SRP"].ToString()), double.Parse(row["GrossWeight"].ToString()), double.Parse(row["NetWeight"].ToString()), double.Parse(row["ShelfWidth"].ToString()), double.Parse(row["ShelfHeight"].ToString()), double.Parse(row["ShelfDepth"].ToString())); if (rowCount = 0) MessageBox.Show("No rows could be updated"); else MessageBox.Show("Rows were updated"); } catch (Exception ex) { MessageBox.Show("The following error occured " + ex.Message); } MessageBox.Show("Update complete"); }