Why ConnectionString fails for SqlConnection using MSN example in C#?

Data Source property needs to point to your SQL instance name, and if your SQL instance is the default one.

Up vote 0 down vote favorite 1 share g+ share fb share tw.

I am using the following tutorial example verbatim: msdn.microsoft.com/en-us/library/system.... The error message is that the connection failed. "Modify it to connect to a Norhtwinf=d database accessible to your system. " string connectionString = "Integrated Security=SSPI;Persist Security Info=False;" + "Initial Catalog=Northwind;Data Source=localhost"; SqlConnection northwindConnection = new SqlConnection(connectionString); northwindConnection.Open(); As far as Northwind Database, I downloaded it from this website and I ran it.

http://www.microsoft.com/download/en/details.aspx?id=23654 Would you be able to tell what am I doing wrong? Thanks c# microsoft sqlconnection northwind link|improve this question edited Apr 4 at 15:19Erik Dietrich2,4611316 asked Apr 4 at 15:16user12989251.

– Oded Apr 4 at 15:20 Also, make sure SQLServer is running. Right click my computer, go to manage and turn it on. – PaulG Apr 4 at 15:21 Do you definitely have Northwind as a database in SQL Server Management studio?

The sample you link is for SQL 2000 - I doubt that would automatically install itself into a more modern SQL Server. Which version are you running? Can you not download the sample databases for that?

– Rup Apr 4 at 15:21.

Data Source property needs to point to your SQL instance name, and if your SQL instance is the default one. I know that the next suggestion is a little weird and looks like the same that you are using, but try and let me know what happened: string connectionString = "Integrated Security=SSPI;Persist Security Info=False;" + "Initial Catalog=Northwind;Data Source=. "; note that I've modified the Data Source value from 'localhost' to a (dot).

Your suggestion did not work. – user1298925 Apr 4 at 15:42 Your suggestion did not work – user1298925 Apr 4 at 15:55 can you check that your SQL instance is reachable? – Mohammed ElSayed Apr 5 at 12:18.

Make sure the account has access to that database, and try using this connection string: connectionString="Server=MACHINE-NAME\SQLEXPRESS;Database=Northwind;Trusted_Connection=True.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions