Exemple #1
0
        private void editReader_Click(object sender, EventArgs e)
        {
            try
            {
                int    index             = readerSearchResult.CurrentRow.Index;
                string inputborrowid     = readerSearchResult.Rows[index].Cells[0].Value.ToString().Trim();
                string inputrname        = readerSearchResult.Rows[index].Cells[1].Value.ToString().Trim();
                string inputsex          = readerSearchResult.Rows[index].Cells[2].Value.ToString().Trim();
                string inputjob          = readerSearchResult.Rows[index].Cells[3].Value.ToString().Trim();
                string inputrCurNum      = readerSearchResult.Rows[index].Cells[4].Value.ToString().Trim();
                string inputrBorrowedNum = readerSearchResult.Rows[index].Cells[5].Value.ToString().Trim();
                string inputdept         = readerSearchResult.Rows[index].Cells[6].Value.ToString().Trim();
                string inputphone        = readerSearchResult.Rows[index].Cells[7].Value.ToString().Trim();
                string inputaccount      = readerSearchResult.Rows[index].Cells[8].Value.ToString().Trim();

                ReaderEdit readerEditForm = new ReaderEdit(inputborrowid, inputrname, inputrCurNum, inputrBorrowedNum, inputjob, inputphone, inputdept, inputaccount, inputsex);
                readerEditForm.Text   = "读者信息编辑";
                readerEditForm.opType = "EDIT";
                readerEditForm.ShowDialog();
                readerEditForm.Dispose();

                //刷新读者查询的结果
                string readerSearchSql =
                    String.Format("select * from readers where borrowid like '%{0}%' and rname like '%{1}%' and sex='{2}' and job like '%{3}%' and rCurNum>={4} and rBorrowedNum>={5} and dept like '%{6}%' and phone like '%{7}%'",
                                  borrowid.Text, rname.Text, sex.Text, job.Text, rCurNum.Text, rBorrowedNum.Text, dept.Text, phone.Text);
                DataSet result = DbHelperSQL.Query(readerSearchSql);

                this.readerSearchResult.DataSource = result.Tables["ds"];
            }
            catch (NullReferenceException exception)
            {
                MessageBox.Show("请先选中一行!");
                return;
            }
        }
Exemple #2
0
        private void addReader_Click(object sender, EventArgs e)
        {
            ReaderEdit readerEditForm = new ReaderEdit();

            readerEditForm.Text   = "读者信息添加";
            readerEditForm.opType = "ADD";
            readerEditForm.ShowDialog();
            readerEditForm.Dispose();

            //刷新读者查询的结果
            string readerSearchSql =
                String.Format("select * from readers where borrowid like '%{0}%' and rname like '%{1}%' and sex='{2}' and job like '%{3}%' and rCurNum>={4} and rBorrowedNum>={5} and dept like '%{6}%' and phone like '%{7}%'",
                              borrowid.Text, rname.Text, sex.Text, job.Text, rCurNum.Text, rBorrowedNum.Text, dept.Text, phone.Text);
            DataSet result = DbHelperSQL.Query(readerSearchSql);

            this.readerSearchResult.DataSource = result.Tables["ds"];
        }