protected void btn_add_Click(object sender, EventArgs e) { AdminTableAdapter ta_admin = new AdminTableAdapter(); DataTable dt_user = ta_admin.GetAdminByName(txt_name.Text); if (dt_user.Rows.Count != 0) { lab_tip.Text = "账户名已存在"; } else { ta_admin.InsertAdmin(txt_name.Text, txt_psw.Text, 2); lab_tip.Text = "添加成功"; } }