VB.net SQLConnect Connection String

I am trying to open a database connection with SQLConnect. Working in Visual studio, when I use the following connection string I get an error message "Login failed for user '**\******'."

Connection string:
"Data Source=*****;Initial Catalog=*******; User ID=**\*****; Password=******; Integrated Security=False;Trusted_Connection=False;"

However, if I use the "Run As" option to run visual studio as the user with access to the database, and use the following connection string it works.

Connection String:
 "Data Source=*******;Initial Catalog=*******; Integrated Security=True"

Why can I not pass the credentials necessary in the connection string to access the database?

(note: all sensitive information is starred out)
Who is Participating?
DimitrisSenior Solution ArchitectCommented:
Then you use Integrated Security=True the SQL logins with your windows credentials.
When you use Integrated Security=False you have to login with SQL Login not windows integrated authentication
you can only specify SQL login credentials in the userid/password syntax.  You cannot pass windows authentication.  Your Integrated Security=True connection is valid, but if you are running on vista then you must "run as" administrator in order to elevate your account to TRUE admin privileges.
The credentials are different in the two cases. The first needs a userid and password defined in SQL Server the second uses the current user's Windows logon. So are you using the correct username/password combination in the first example?
Cloud Class® Course: Microsoft Windows 7 Basic

This introductory course to Windows 7 environment will teach you about working with the Windows operating system. You will learn about basic functions including start menu; the desktop; managing files, folders, and libraries.

Fernando SotoRetiredCommented:
Hi Un-Obtainium;

I believe that the, User ID=**\***** with  Password=******;, must be entered into SQL server as a SQL server user with permissions to use the database. I am not an expert on SQL server but believe this to be the issue.

You can explicitly add a windows account to sql server.  But doing so does not allow you to specify it in the connectionstring.  Use of userid\password is only valid for passing SQL credentials.  For windows authentication, it uses the current user context.  In order to connect with admin privileges under vista with UAC enabled, you have to "Run As" as mentioned.
Un-ObtainiumAuthor Commented:
Thanks, I am getting the SQL account created now and I will let you know if it works.
FYI... SQL accounts are not "domain\user".  user accounts containing a \ are interpreted as windows login accounts in the domain\user or computer\user format.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.