public void ExportAddresses() { SqlCompactConnection conn = new SqlCompactConnection(); try { Address add = new Address(); AddressCollection AddCol = new AddressCollection(); string where = "addressid in (select Addressid from customer where activeflag=1)"; string orderby = "addressid"; AddCol = add.GetAddressCollection(where, orderby); conn.DropAddressTable(); conn.CreateAddressTable(); conn.SynchForm = this; conn.AddAddress(AddCol); } catch (Exception ex) { MessageBox.Show(ex.Message, "MICS", MessageBoxButtons.OK, MessageBoxIcon.Error); } finally { conn.CloseDatabase(); conn = null; } }