string connString = @"Server=MRLI\SQLEXPRESS;Database=ly;User Id=yz;Password=yz;Trusted_Connection=False";        SqlConnection cn = new SqlConnection(connString);
        SqlCommand cmd = new SqlCommand("select * from Student", cn);
        SqlDataAdapter da=new SqlDataAdapter(cmd);
        DataSet ds = new DataSet();
        da.Fill(ds, "Student");不知道怎么回事。找不到Student表。是不是这样连接的?   我都搞晕了。这么简单的都不会。555555

解决方案 »

  1.   

    登录数据库的用户名和密码是否正确,配置是否正确 
    server=./sqlexpress;User ID=sa;Password=sa;database=master 
    Server=127.0.0.1/SQLEXPRESS
      

  2.   

    抛出一个错误看看是怎么提示的啦,是不是你的sql2005配置有问题呀,只从代码上是看不出来环境配置的问题。
      

  3.   

    如果数据库是安装在其他的机子上,那么:string connString = @"Server=数据库服务器IP地址/SQLEXPRESS;Database=数据库库名称;User Id=yz;Password=yz"; 如果数据库是在自己的机子上,那么:
    string connString = @"Server=./SQLEXPRESS;Database=数据库库名称;User Id=yz;Password=yz"; 
      

  4.   

    IP,
    database,
    user_id,
    password,
    这些东西对吗?
    到程序里调试一下,看看!