Esempio n. 1
0
        private void điểmDanhToolStripMenuItem_Click(object sender, EventArgs e)
        {
            connect = cn.getConnect();
            connect.Open();
            SqlCommand command = new SqlCommand();

            command.CommandType = CommandType.Text;
            command.Connection  = connect;
            string   text = "", sql = "";
            TreeNode theNode = this.TvDanhSachLop.SelectedNode;
            int      tag     = 0;

            if (theNode.Tag == "1")
            {
                sql = "select MaLop from Lop where TenLop= N'" + theNode.Text + "'";
                tag = 1;
            }
            else
            if (theNode.Tag == "2")
            {
                sql = "select MaLop from LopHocPhan where TenLop= N'" + theNode.Text + "'";
                tag = 2;
            }
            else
            {
                MessageBox.Show("Bạn chưa chọn lớp cần điểm danh!", "Thông báo");
                return;
            }
            //string str = "select  from SinhVien sv, " + tmp + " lop where sv.MaLop = TenLop= N'" + theNode.Text + "'";
            SqlDataAdapter da = new SqlDataAdapter(sql, connect);
            DataTable      tb = new DataTable();// cn.getTable(sql);

            da.Fill(tb);
            text = tb.Rows[0][0].ToString();
            connect.Close();
            frmDiemDanh frm = new frmDiemDanh(text, tag); // text ma lop

            frm.ShowDialog();
            dataGridView1.DataSource = getTable(theNode.Text, Convert.ToInt16(theNode.Tag));//cn.getTable(sql);
            color();
        }
Esempio n. 2
0
        private void điểmDanhToolStripMenuItem_Click(object sender, EventArgs e)
        {
            frmDiemDanh frm = new frmDiemDanh();

            frm.ShowDialog();
        }