我的程序是这样的
public partial class _Default : System.Web.UI.Page 
{
    protected void Page_Load(object sender, EventArgs e)
    {
        SqlConnection conn = new SqlConnection("server=(local);" + "Database=Northwind;" + "IntegratedSecurity=true");
        conn.Open();
        SqlCommand cmd = new SqlCommand("Select * from Employee", conn); 
        SqlDataReader reader = cmd.ExecuteReader();
        while (reader.Read())
        {
            Response.Write(reader["FirstName"] + "" + reader["LastName"]);
        }
        conn.Close();
    }
}
运行后的结果是:
不支持关键字: “integratedsecurity”。 
请问如何解决.

解决方案 »

  1.   

    使用Windows集成身份验证。 
    过去(如使用ODBC时)的写法一般为Trusted Connection=True; 
    现在常用Integrated Security=SSPI;
    看看自己是什么身份验证登陆数据库?
      

  2.   

    谢谢,这个解决了.现在有是:
    “/testsql”应用程序中的服务器错误。
    --------------------------------------------------------------------------------对象名 'Employee' 无效。 
    说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。 
    异常详细信息: System.Data.SqlClient.SqlException: 对象名 'UserInfo' 无效。
     
    我在SQL中建了testsql数据库,有表UserInfo...
    这个问题如何处理.