title: Problem filling data table with SQL adapter in ASP.NET
body: <p>I have a username db table that I'm trying to connect with to compare the username/pass.</p>
  
  <p>Here is my code, it's not working, what am I doing wrong?</p>
  
  <pre><code>DataTable dt = null;
  
  protected void btn_Click_Login(object sender, EventArgs e)
  {
      string query = string.Format("SELECT * FROM Users WHERE Username='{0}' AND Password='{1}'", txtUsername.Text, txtPassword.Text);
  
      using (SqlConnection c = new SqlConnection(ConfigurationManager.ConnectionStrings["RBConnectionString"].ConnectionString))
      {
          c.Open();
  
          using (SqlDataAdapter a = new SqlDataAdapter(query, c))
          {
              DataTable t = new DataTable();
              a.Fill(t);
          }
      }
      if (dt.Rows.Count &gt; 0)
      {
          Session["Username"] = txtUsername.Text;
          Session["Password"] = txtPassword.Text;
          Response.Redirect("main.aspx");
          lblError.Text = "success";
      }
      else
      {
          lblError.Text = "Wrong Username/Password combination";
      }
  } 
  </code></pre>
  
  <p>}</p>