VISUAL STUDIO 2010 无法连接数据库
protected void Button2_Click(object sender, EventArgs e)
{
TextBox1.Text = "";
TextBox2.Text = "";
TextBox3.Text = "please try again later";
Console.WriteLine("aaaaaaaaaaaaaaaaaaaaaaaaa");
string constr = "server=smith-PC;database=save ;User Id=sa;Password=kqvfhpsiq;integrated security=true";
SqlConnection con = new SqlConnection(constr);
con.Open();
string str = "select * from saveinfo ";
SqlCommand cmd = new SqlCommand(str, con);
SqlDataReader dr = cmd.ExecuteReader();
}
[解决办法]
conn = new System.Data.SqlClient.SqlConnection(@"Data Source=ADMIN;Initial Catalog=TEST;Integrated Security=True");