'I connot able to filter the current user record using c# and MS Access DB

I connot able to filter the current user record. I want to display the data of current user only. But I did not understand how to handl query. here is the ss of login. enter image description here

As I selected Student, and username =50 and pass=50 ,

and when i press he show button this will display all the record but i want only current user data : enter image description here

here is the code :

conn.Open();
                    OleDbCommand cmd = new OleDbCommand();
                    cmd.Connection = conn;
                    OleDbDataAdapter sda = new OleDbDataAdapter(@"SELECT student.s_id, student.f_name, student.l_name, student.email, student.address, course.c_id, course.cname, resultdate.resultgrade FROM ((student INNER JOIN resultdate ON student.s_id = resultdate.s_id) INNER JOIN course ON resultdate.c_id = course.c_id)", conn);
                DataTable dt = new DataTable();
                sda.Fill(dt);
                dataGridView1.DataSource = dt;
                //dataGridView1.Text = dt.Rows.Count.ToString();
                conn.Close();


Solution 1:[1]

Paste this code in your combobox.

        con.Open();

        string query = “ select* from student where student.s_id =  ’”
        +combobox1.SelectedItem.ToString() + “’”;
        OleDbDataAdapter sda = new OleDbDataAdapter(query, con);
        OleDbCommandBuiler builer = new OleDbCommandBuiler(da);
        var ds = new DataSet();
        sda.Fill(ds);
        datagridview1.Datasource = ds.Table[0];

        conn.Close();

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 cigien