Exemplo n.º 1
0
        private void button13_Click(object sender, EventArgs e)
        {
            string readerid     = txt_rid.Text.Trim();
            string rname        = txt_rname.Text.Trim();
            string sex          = txt_sex.Text.Trim();
            string jobTitle     = txt_job.Text.Trim();
            string canBorrowNum = txt_cbn.Text.Trim();
            string borrowedNum  = txt_bn.Text.Trim();
            string department   = txt_dept.Text.Trim();
            string phone        = txt_phone.Text.Trim();
            int    index        = -1;

            index = Readerlist.CurrentRow.Index;//获取当前选中行
            string inputreaderid = Readerlist.Rows[index].Cells[0].Value.ToString().Trim();

            if (index == -1)
            {
                MessageBox.Show("请选择要编辑的行");
                return;
            }

            EditReader childrenform = new EditReader(inputreaderid);

            childrenform.Owner = this;
            childrenform.ShowDialog();
            childrenform.Dispose();

            this.Readerlist.DataSource = Query("select * from readerTable where ReaderId like '%" + readerid + "%' and ReaderName like '%" + rname + "%' and Sex like '%" + sex + "%' and JobTitle like '%" + jobTitle + "%' and CanBorrowNum like '%" + canBorrowNum + "%' and BorrowedNum like '%" + borrowedNum + "%' and Department like '%" + department + "%' and PhoneNumber like '%" + phone + "%'").Tables["ds"];
        }
Exemplo n.º 2
0
 private void confirm_Click(object sender, EventArgs e)
 {
     try
     {
         string readerid     = txt_rid.Text.Trim();
         string rname        = txt_rname.Text.Trim();
         string sex          = txt_sex.Text.Trim();
         string jobTitle     = txt_job.Text.Trim();
         string canBorrowNum = txt_cbn.Text.Trim();
         string borrowedNum  = txt_bn.Text.Trim();
         string department   = txt_dep.Text.Trim();
         string phone        = txt_phone.Text.Trim();
         string sql          = String.Format(@"update readerTable set ReaderName = '{0}' , Sex = '{1}' , JobTitle = '{2}' , CanBorrowNum = '{3}' , BorrowedNum = '{4}' , Department = '{5}' , PhoneNumber = '{6}' where ReaderId = '{7}'"
                                             , rname, sex, jobTitle, canBorrowNum, borrowedNum, department, phone, readerid);
         EditReader.ExecuteSql(sql);
         MessageBox.Show("编辑成功");
     }
     catch (Exception exception)
     {
         MessageBox.Show(exception.Message);
         return;
     }
     this.Close();
 }