title: Error in sda.Fill (dt);
body: <p>I have created a login page in Visual Studio 10. I get this error showing up every time I run the program:</p>
  
  <p><a href="https://i.stack.imgur.com/Q4IZZ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Q4IZZ.png" alt="enter image description here"></a></p>
  
  <p>Here's my code for <code>css/Default.aspx.cs</code>:</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Web;
  using System.Web.UI;
  using System.Web.UI.WebControls;
  using System.Data;
  using System.Data.SqlClient;
  
  public partial class css_Default : System.Web.UI.Page
  {
    protected void Page_Load(object sender, EventArgs e)
    {
  
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
      SqlConnection con = new SqlConnection("Data Source=.;Initial Catalog=login;Integrated Security=True;");
      SqlDataAdapter sda=new SqlDataAdapter("Select count(*) From Log_Table Where UserName ='" + TextBox1.Text + "' and Password='" + TextBox2.Text + "'",con);
      DataTable dt = new DataTable();
      sda.Fill(dt);
  
      if (dt.Rows[0][0].ToString() == "1")
      {
          Response.Redirect("Default2.aspx");
      }
      else
      {
          Label1.Visible = true;
      }
    }
  }
  </code></pre>