protected void btnInsert_Click(object sender, EventArgs e) { try { ACMS.VO.UnitVO myUnitVO = new ACMS.VO.UnitVO(); myUnitVO.name = txtname.Text; ACMS.DAO.UnitDAO myUnitDAO = new ACMS.DAO.UnitDAO(); if (myUnitDAO.chkDuplicateName(0, txtname.Text)) { clsMyObj.ShowMessage(txtname.Text + "已重覆.無法新增"); return; } myUnitDAO.InsertUnit(myUnitVO); GridView1.DataBind(); } catch (Exception ex) { WriteErrorLog("Insert", ex.Message, "0"); } }