예제 #1
0
        private void button2_Click(object sender, EventArgs e)
        {
            PleaseWait objPleaseWait = new PleaseWait();

            try {
                objPleaseWait.Show();
                objPleaseWait.Update();

                foreach (DataRow row in _table.Rows)
                {
                    dm_trangvang dm = new dm_trangvang();
                    dm.name     = row["name"].ToString();
                    dm.path     = row["path"].ToString();
                    dm.paren_id = ConvertType.ToInt(row["parentid"].ToString());

                    if (ConvertType.ToInt(SQLDatabase.ExcScalar(string.Format("select count(*) from dm_trangvang where path='{0}'", dm.path))) > 0)
                    {
                        SQLDatabase.UpdatedmTrangVang(dm);
                    }
                    else
                    {
                        SQLDatabase.AdddmTrangVang(dm);
                        row["id"] = dm.id;
                    }
                }
                objPleaseWait.Close();
            }
            catch (Exception ex) {
                if (objPleaseWait != null)
                {
                    objPleaseWait.Close();
                }

                MessageBox.Show(ex.Message, "button2_Click");
            }
        }