title: C# SQL How do i make users only see their details in datagridview when logged on
body: <p>I'm currently developing a windows form application in visual studio 2012 which has two different logins based off whether the user is a client or admin. The Picture belows shows the login table for the sql database. </p>
  
  <p><a href="https://i.stack.imgur.com/3PVO9.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/3PVO9.jpg" alt="Picture of image"></a></p>
  
  <p>As you can see this is a very simple login system that has 3 columns which are Username, password and role (which determines whether a user is admin or client). 
  The problem i have is that i want to create a form that allows users whose role is a client to view their own username and password information from the login table  through the use of a datagridview. </p>
  
  <p>At the moment i have a button which will display all the information of every user from the login table in datagridview, how do i edit my code so that the datagridview only shows the login table details of the current logged in user? instead of displaying the login details of all users like it is now.</p>
  
  <p>Here is an image of the datagrid view and view button.</p>
  
  <p><a href="https://i.stack.imgur.com/dSrj9.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/dSrj9.png" alt="Basic concept image of datagridview and view button"></a></p>
  
  <p>Below is the code for the datagridview and view button. </p>
  
  <pre><code>{ public ClientAnalyzeyourowninformation()
      {
          InitializeComponent();
      }
      SqlConnection con = new SqlConnection(@"Data Source=(LocalDB)\v11.0;AttachDbFilename=|DataDirectory|Data.mdf;Integrated Security=True");
      private void button1_Click(object sender, EventArgs e)
      {
          // this is the code for the view button of admin menu
          con.Open();
          SqlDataAdapter sda = new SqlDataAdapter("SELECT * FROM Login", con);
          DataTable DATA = new DataTable();
          sda.Fill(DATA);
          dataGridView1.DataSource = DATA;
          con.Close();
  
      } 
  </code></pre>