Sunday, February 12, 2012

Connect to SQL Server using Integrated Security=true

Hi all,
I use the following connectionstring connect to sqlserv
server=(local); database=mydata;Integrated Security=true
If I tried browse the website in VS Web Developer 2005 environment, it's ok. After I compiled the site and access through IIS server, can not connect to sqlserver , I need to use login and password to connect. How can I connect wihtout using LogID and password.

Thanks

You should change your database connection code like this,and it works well

SqlConnection myConnection =new SqlConnection("Data Source=localhost;Integrated Security=SSPI;Initial Catalog=Sample;");

myConnection.Open();

|||

taoge:

Hi all,
I use the following connectionstring connect to sqlserv
server=(local); database=mydata;Integrated Security=true
If I tried browse the website in VS Web Developer 2005 environment, it's ok. After I compiled the site and access through IIS server, can not connect to sqlserver , I need to use login and password to connect. How can I connect wihtout using LogID and password.

Thanks


What's the error message? If it is something like 'Login failed for user xxx/ASPNET...', you can take a look at this post:

http://forums.asp.net/thread/1356875.aspx

No comments:

Post a Comment