vs2010连接sqlserver的windows身份,怎么连接?
帮帮忙!谢谢了!
[解决办法]
连接字符串, Integrated Security=SSPI
[解决办法]
<configuration> <connectionStrings> <!-- Windows 身份验证 --> <!--<add name="ConnectionString" connectionString="Data Source=.;Initial Catalog=TestDB;Integrated Security=True" providerName="System.Data.SqlClient" />--> <!-- SQL Server 身份验证 --> <add name="ConnectionString" connectionString="Data Source=.;Initial Catalog=TestDB;Persist Security Info=True;User ID=sa;Password=sa" providerName="System.Data.SqlClient" /> </connectionStrings></configuration>
[解决办法]
1,Windows验证
Common.ConnString = @"Initial Catalog=数据库名;Data Source=电脑名或IP地址;Integrated Security=SSPI";
2, Sql混合验证
Common.ConnString = @"server=电脑名或IP地址;database=数据库名;uid=用户名;password=密码";