-1

I have developed a WindowsForm C# application which is connected to the SQL database with the following ConnectionString style:¨

ConnectionString = "Data Source=23PC\\SQLExpress;Initial Catalog=DB;User ID=USER1;Password=***;Integrated Security=false;";

And it works perfect for me and the users on the network. I wonder how I can change the CS to make it available for Windows Authentication login rather than Mixed Mode, i.e. without determining U and P.

AlanD
  • 55
  • 1
  • 8

2 Answers2

0

This is the connection string I always use:

String.Format("Data Source={0};Initial Catalog={1};Integrated Security=True", myDBServerName, myDBName)

This will require that you configure your SQL Server permissions accordingly so that your Windows users have proper logins and access to the database.

rory.ap
  • 34,009
  • 10
  • 83
  • 174
  • Sorry @royap. I tested this one and it doest work for network users! – AlanD Jan 21 '15 at 15:00
  • @AlanD -- If you can elaborate, I might be able to help. I've used this approach for over 8 years. – rory.ap Jan 21 '15 at 15:02
  • Now the question is which Group should I grant permission to? @royap Thanks – AlanD Jan 21 '15 at 15:09
  • @AlanD Is this database a SQL Express database on your computer? Or is it a database that's even accessible to network users? No one would be able to access a SQL Express database on your computer from elsewhere on the network. – rory.ap Jan 21 '15 at 15:12
  • It's a SQL Express one and network users can access database using provided credencials. – AlanD Jan 21 '15 at 15:15
  • @AlanD - Are all users in an Active Directory domain? Or just a workgroup on a network? – rory.ap Jan 21 '15 at 15:18
  • @roryap- We are all in AD domain The thing is, my manager can access to the db with provided credentials but cannot alter it! I manually (from my computer) gave her permission to alter database files. But it didn't work! – AlanD Jan 21 '15 at 15:20
  • @AlanD -- It sounds like you need to reconfigure the permissions within the database, which seems to be outside the scope of this question. Your question was about how to provide access to the database for network users. – rory.ap Jan 21 '15 at 15:30
  • @AlanD if you need help with the permissions ask over at dba.stackexchange.com, lots of good help over there. – RubberChickenLeader Jan 21 '15 at 15:42
0

Between this question and the corresponding DBA.SE question, there is a tremendous amount of ambiguity here. It's still not very clear what you're actually asking, but you have something of a question in this "I wonder how I can change the CS to make it available for Windows Authentication login rather than Mixed Mode ..."

To address that: Mixed Mode includes Windows Authentication and, as such, requires proper permissions management. I try to guide this sort of permissions management toward Active Directory Groups. You can add groups the same way that you add users. This is covered here. From there, you can set permissions by group (keeping in mind that DENY trumps all other permissions).

To check if Mixed Mode is enabled (and to enable if necessary), check out this answer.

Please do not upvote if useful. The reality is that this question is a dupe of something already on the site, it's just a matter of figuring out what that dupe may be.

Community
  • 1
  • 1
swasheck
  • 4,644
  • 2
  • 29
  • 56