コード例 #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                sf       = new studentFeeClass();
                dg       = new datagridVeiwWorking();
                sf.month = comboBox1.Text;
                sf.year  = comboBox2.Text;
                if (radioButton1.Checked)
                {
                    string query = "select * from studentFees where monthName ='" + comboBox1.Text + "' and studentYear = '" + comboBox2.Text + "' and paymentAmount >= " + sf.monthlyFee();

                    dataGridView1.DataSource = dg.goFill(query).Tables[0];
                }
                else if (radioButton2.Checked)
                {
                    string query = "select * from studentFees where monthName ='" + comboBox1.Text + "' and studentYear = '" + comboBox2.Text + "' and paymentAmount < " + sf.monthlyFee();

                    dataGridView1.DataSource = dg.goFill(query).Tables[0];
                }
            }
            catch (FormatException)
            {
                MessageBox.Show("Enter Correct Values!!", "Alert!");
            }
        }
コード例 #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            dg = new datagridVeiwWorking();
            rb = new returnBookClass();
            radioLoad rad = new radioLoad();

            dg.query = "SELECT studentID,studentName,serialNo,titleBook,authorBook FROM addingBooks INNER JOIN IssueBooks ON addingBooks.serialNo = IssueBooks.bookID where studentID=" + comboBox1.Text;
            dataGridView1.DataSource = dg.goFill().Tables[0];
            comboBox2.DataSource     = rad.mydt("select * from IssueBooks where studentID = " + comboBox1.Text);
            comboBox2.DisplayMember  = "bookID";
            comboBox2.ValueMember    = "studentID";
        }