为什么用source=(local)不能用,而必须用具体电脑的用户名  computer/beck,怎么改才能用(local)

解决方案 »

  1.   

    // B/S模式连接数据库:  
    string sql="Source=服务器Ip;database=数据库名称;UID=sa;Password=sasa;";  
    // C/S模式连接数据库:  
    string sql="Data Source=服务器Ip;Initial Catalog=数据库名称;User ID=sa;password=sa";  string connectString = "Server=(local);Integrated Security=True;Database=数据库名称";
    string connectString = "Server=.;Integrated Security=True;Database=数据库名称";
    string connectString = "Server=127.0.0.1;Integrated Security=True;Database=数据库名称";
      

  2.   

    我建议用具体的用户名或IP,不要使用local.