public string DoUpLoadSuppliers() { string retval = "1"; var dtsupplier = new DataManager().GetSupplier(); var ds = new DsMaster().SUPPLIER; var taSupplier = new DsMasterTableAdapters.SUPPLIERTableAdapter {Connection = {ConnectionString = _constr}}; taSupplier.Fill(ds); foreach (DataRow dr in dtsupplier.Rows) { var isnew = false; var dsup = ds.FindBySUPPLIERNO(dr["SUPPLIERNO"].ToString()); if (dsup != null) { dsup.BeginEdit(); } else { dsup = (DsMaster.SUPPLIERRow)ds.NewRow(); isnew = true; foreach (DataColumn dc in dtsupplier.Columns) { dsup[dc.ColumnName] = dr[dc.ColumnName]; } } bool update = true; if (!isnew) { update = Equals(dr, dsup); } if (!update) { foreach (DataColumn dc in dtsupplier.Columns) { if (!dc.ReadOnly) dsup[dc.ColumnName] = dr[dc.ColumnName]; } } if (isnew) { ds.Rows.Add(dr.ItemArray); var t = taSupplier.Update(ds); if (t == 0) retval += " Supplier master not created"; } else { dsup.EndEdit(); taSupplier.Update(dsup); } } return retval; }