Hello, I'm building an application that connects to SQL Server 2005. It currently uses Windows authentication, but I'd like to switch to SQL Authentication (I believe it is also sometimes called Mixed Authentication). My current connection string is:
"Data Source=LOCALHOST;Initial Catalog={0};Integrated Security=SSPI"
That's for Windows authentication, but for SQL, I am thinking:
"Data Source=LOCALHOST;Initial Catalog={0};user id={1};password={2}"
Is this the correct way? The code assumes that:
- {0} is the name of the database
- {1} is the username
- {2} is the password
I'm switching to SQL authentication because I'm thinking of connecting to a SQL Server instance on a remote server - is SQL authentication the right way to do this, and would I just have to enter the IP where "LOCALHOST" is currently?
Thanks!
UPDATE: Thank you for all the great answers, guys! All of them were wonderful and very helpful, I can't even decide which one to award "accepted answer" to, but I have voted up all of them because they rock. Thanks again!