Connecting with .Net in SQL Server 2005 (Winforms)

I diong a typical Windows integrated connection from a .Net Winforms application:

Dim sqlConnetion As New SqlConnection ("Server = jupiter; Database = io; Integrated Security = True;") sqlConnetion.Open ()

I keep getting the following error:

Unable to open database "io" requested at login. Login failed. Login failed for user "MARS \ viking".

I've also tried the following connection string variations with the same results:

Data source = jupiter; Home directory = io; Integrated Security = True;

Data source = MSSGDEV; Home directory = MSSQLSERVER; Integrated Security = SSPI;

Unfortunately I can connect to the db using SQL Management Studio with the same user from the same computer using built-in security. Is there a mistake in my connection code? Or is there some special configuration parameter on the SQL server that I have to set in order to allow connections to the code?

+1


a source to share


3 answers


The employee finally found the answer. I would put an sql server instance (my server has two sql server instances) in the slot where the database name belonged ... Thanks everyone for taking the time to help figure this out.



0


a source


Try "Data Source = Jupiter; Initial Directory = io; Integrated Security = True; instead. If you are using Integrated Security, you need to use Source Source / Initial Catalog. If you are using Trusted_Connection, you can use Server / Database. ConnectionStrings.com is fantastic.



+2


a source


Edited my answer (as the question was updated):

You need to change "Integrated Security = True"; to "Integrated Security = SSPI" or "Trusted_Connection = True"

(note the underline in "Trusted_Connection")

+1


a source







All Articles