title: how do i correct no row at position 0
body: <p>i want to build a multiuser window form but whenever i run code i get the error</p>
  <blockquote>
  <p>there is no row at position 0</p>
  </blockquote>
  <pre><code>   private void button1_Click(object sender, EventArgs e)
          {
              SqlConnection con = new SqlConnection(@&quot;Data Source=DESKTOP-LAI8526\SQLEXPRESS;Initial Catalog=user_dt;Integrated Security=True&quot;);
              SqlCommand cmd = new SqlCommand(&quot;select * from lgn_table where user_id='&quot; + textBox1.Text + &quot;'and user_psd='&quot; + textBox2.Text + &quot;' and user_type='&quot; + comboBox1.Text + &quot;' &quot;, con);
              SqlDataAdapter sda = new SqlDataAdapter(cmd);
              DataTable dt = new DataTable();
                  sda.Fill(dt);
              if (dt.Rows[0][0].ToString() == &quot;1&quot;)
              {
                  SqlDataAdapter sda1 = new SqlDataAdapter(&quot;select user_type from lgn_table where user_id='&quot; + textBox1.Text + &quot;'and user_psd='&quot; + textBox2.Text + &quot;'&quot;, con);
                  DataTable dt1 = new DataTable();
                  sda1.Fill(dt1);
                  if (dt1.Rows[0][0].ToString() == &quot;admin&quot;)
                  {
                      Form2 f = new Form2();
                      f.Show();
                      this.Hide();
                  }
                  if (dt1.Rows[0][0].ToString() == &quot;employee&quot;)
                  {
                      Form1 d = new Form1();
                      d.Show();
                      this.Hide();
                  }
  
              }
          }
      }
  </code></pre>