title: Fill public strings with Database info from userlogin
body: <p>I have created a class that gets the user details from DB to strings (username,userpassword,usernr,usersubco).
  What i want to happen is that those strings fill with the info from the user I login with.</p>
  
  <pre><code>public class Details
  {
      public connectionUser constring = new connectionUser();
      public string Technr;
      public string Techpass;
      public string Techname;
      public string Techsubco;
      public Details()
      {
          using (SqlConnection con = new SqlConnection(constring.source))
          {
              myInlogForm myI = new myInlogForm();
              con.Open();
              SqlCommand cmd = new SqlCommand("select * from techs where technr=@technr", con);
              cmd.Parameters.Add(@"technr", SqlDbType.Int).Value = myI.technr;
              cmd.ExecuteNonQuery();
              SqlDataReader reader = cmd.ExecuteReader();
              while (reader.Read())
              {
                  Technr = reader[0].ToString();
                  Techpass = reader[1].ToString();
                  Techname = reader[2].ToString();
                  Techsubco = reader[3].ToString();
                  break;
              }
              con.Close();
  
          }
          MessageBox.Show(Techname + Technr + Techpass + Techsubco);
      }
  </code></pre>
  
  <p><code>myI = usercontrol (inlogscreen)</code>
  <code>myIn.technummer</code> is a public string that get value on loginbutton from textbox.</p>
  
  <p>when I push login I got the message box from this class above (empty) and following error :</p>
  
  <p>UPDATED !!!</p>
  
  <blockquote>
    <p>System.Data.SqlClient.SqlException: 'The parameterized query
    '(@technr int)select * from techs where technr=@technr' expects the
    parameter '@technr', which was not supplied.'</p>
  </blockquote>
  
  <pre><code>public event EventHandler&lt;EventArgs&gt; callMenu; // oproep door mainform
      public event EventHandler&lt;EventArgs&gt; callDash; // oproep door mainform
      public int technr;
  
      private void loginBtn_Click(object sender, EventArgs e)
      {
          using (SqlConnection con = new SqlConnection(cUser.source.ToString()))
          {
              con.Open();
              SqlCommand cmd = new SqlCommand("select technr,techcode from techs where technr=@technr and techcode=@techcode", con);
              cmd.Parameters.Add(@"technr",SqlDbType.Int).Value = userTxb.Text;
              cmd.Parameters.Add(@"techcode",SqlDbType.VarChar).Value = passTxb.Text;
              cmd.ExecuteNonQuery();
              SqlDataAdapter da = new SqlDataAdapter(cmd);
              DataTable dt = new DataTable();
              da.Fill(dt);
              if (dt.Rows.Count &gt; 0 &amp;&amp; callMenu != null &amp;&amp; callDash != null) // checks login is juist
              {
                  callMenu(this, new EventArgs());
                  callDash(this, new EventArgs());
                  technr = int.Parse(userTxb.Text);             
  
              }
              else
              {
                  MessageBox.Show("Foutieve gegevens");
              }
              con.Close();
          }
      }
  </code></pre>