//创建使用Windows登陆的 SqlConnection对象
SqlConnection con = new SqlConnection("server=.;uid=sa;pwd=sa;database=demodb");
这一句改为
SqlConnection con = new SqlConnection("server=.\\SQLEXPRESS;uid=sa;pwd=sa;database=demodb");试下
//创建使用Windows登陆的 SqlConnection对象
SqlConnection con = new SqlConnection("server=.;uid=sa;pwd=sa;database=demodb");
//创建SqlCommand对象
SqlCommand com = con.CreateCommand();
com.CommandText = "SELECT * FROM Employee";
//创建数据适配器对象
SqlDataAdapter adpt = new SqlDataAdapter();
adpt.SelectCommand = com;
//填充DataSet
DataSet ds = new DataSet();
adpt.Fill(ds);