public void ExportProducts() { SqlCompactConnection conn = new SqlCompactConnection(); Product p = new Product(); ProductCollection ProdCol = new ProductCollection(); int i = 0; try { string where = "activeflag=1"; string orderby = "productid"; ProdCol = p.GetProductsCollection(where, orderby); conn.DropProdctTable(); conn.CreateProductTable(); conn.SynchForm = this; conn.AddProduct(ProdCol); } catch (Exception ex) { log.Write("Product Record faild to export (id=" + ProdCol[i].ProductID + "). Error:" + ex.Message, "frmSynch.ExportProduct"); MessageBox.Show(ex.Message, "MICS", MessageBoxButtons.OK, MessageBoxIcon.Error); } finally { conn.CloseDatabase(); conn = null; } }