Mysql sda填充错误(dt);

Mysql sda填充错误(dt);,mysql,sql,sql-server,visual-studio,visual-studio-2010,Mysql,Sql,Sql Server,Visual Studio,Visual Studio 2010,我已经在VisualStudio10中创建了一个登录页面。每次运行程序时都会出现以下错误: 这是我的css/Default.aspx.cs代码: 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.

我已经在VisualStudio10中创建了一个登录页面。每次运行程序时都会出现以下错误:

这是我的
css/Default.aspx.cs
代码:

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;
    }
  }
}

你还没有打开连接

con.Open();