private void button2_Click(object sender, EventArgs e) { PleaseWait objPleaseWait = new PleaseWait(); try { objPleaseWait.Show(); objPleaseWait.Update(); foreach (DataRow row in _table.Rows) { dm_muaban dm = new dm_muaban(); dm.name = row["name"].ToString(); dm.path = row["path"].ToString(); dm.parentId = ConvertType.ToInt(txtid.Text); if (ConvertType.ToInt(SQLDatabase.ExcScalar(string.Format("select count(*) from dm_muaban where path='{0}'", dm.path))) > 0) { SQLDatabase.UpdatedmMuaban(dm); } else { SQLDatabase.AddmMuaban(dm); row["id"] = dm.id; } } cmd_muaban_tv_danhmuc_SelectedIndexChanged(null, null); objPleaseWait.Close(); } catch (Exception ex) { if (objPleaseWait != null) { objPleaseWait.Close(); } MessageBox.Show(ex.Message, "button2_Click"); } }