Wednesday, 20 September 2017

Database application # 5 VIEWS AND SEARCH FILTER





public partial class viewform : Form
    {
        viewclass vc = new viewclass();
        string q;
        public viewform()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            q = "select s.std_id as 'id',s.std_name as 'Name',s.std_fname AS 'Father name',s.std_gender as 'Gender',s.std_address as 'Address',s.std_admissiondate as 'Admission Date' ,a.ad_name as 'Admin Name' from student s inner join administator a on a.ad_id=s.std_ad_fk_id where s.std_id=" + textBox2.Text;
            dataGridView1.DataSource = vc.showrecord(q);

            returnclass rc = new returnclass();
          string pathquerry=  rc.scalarReturn("select img_path from student_img where img_fk="+textBox2.Text);
          pictureBox1.Image = Image.FromFile(pathquerry);
          pictureBox1.SizeMode = PictureBoxSizeMode.StretchImage;

           

        }

        private void viewform_Load(object sender, EventArgs e)
        {
            q = "select s.std_id as 'id',s.std_name as 'Name',s.std_fname AS 'Father name',s.std_gender as 'Gender',s.std_address as 'Address',s.std_admissiondate as 'Admission Date' ,a.ad_name as 'Admin Name' from student s inner join administator a on a.ad_id=s.std_ad_fk_id";
            dataGridView1.DataSource = vc.showrecord(q);

        }

        private void textBox1_KeyUp(object sender, KeyEventArgs e)
        {
            q = "select s.std_id as 'id',s.std_name as 'Name',s.std_fname AS 'Father name',s.std_gender as 'Gender',s.std_address as 'Address',s.std_admissiondate as 'Admission Date' ,a.ad_name as 'Admin Name' from student s inner join administator a on a.ad_id=s.std_ad_fk_id where s.std_name like '" + textBox1.Text + "%'";
            dataGridView1.DataSource = vc.showrecord(q);

        }
       
    }
}

1 comment:

  1. sir,
    how r u?Guide me how to enroll in software house?

    ReplyDelete

Pass Dynamically Added Html Table Records List To Controller In Asp.net MVC

Controller Code: using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; using ...