Пример #1
0
        public static ArrayList getStudentsReg(int batchid)
        {
            ArrayList    alist = new ArrayList();
            string       query = "select * from student_registration where batch_id=" + batchid;
            OleDbCommand com   = new OleDbCommand(query, con);

            con.Open();
            OleDbDataReader read = com.ExecuteReader();


            while (read.Read())
            {
                StudentRegistrationModel rec = new StudentRegistrationModel();

                rec.RollNo  = read.GetString(0);
                rec.Batchid = read.GetInt32(1);
                //rec. =
                rec.Name     = read.GetString(2);
                rec.Fname    = read.GetString(3);
                rec.SurName  = read.GetString(4);
                rec.Gender   = read.GetString(5);
                rec.Email    = read.GetString(6);
                rec.MobileNo = read.GetString(8);
                rec.Pass     = read.GetString(7);
                rec.Address  = read.GetString(9);

                alist.Add(rec);
            }
            con.Close();
            return(alist);
        }
        private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            StudentRegistrationModel rec = (StudentRegistrationModel)listBox1.SelectedItem;

            IDtext.Text    = "" + rec.RollNo;
            NameText.Text  = "" + rec.Name;
            fnameText.Text = "" + rec.Fname;

            genderText.Text = "" + rec.Gender;

            surNameText.Text = "" + rec.SurName;
            emailText.Text   = "" + rec.Email;
            passText.Text    = "" + rec.Pass;
            AddText.Text     = "" + rec.Address;
            mobileText.Text  = "" + rec.MobileNo;
        }