views:

52

answers:

2

I'm trying to follow this example but I get an Exception related to the connection string telling me that the server was not found or was not accessible. The tutorial itself tells me on step 5 to "Change the connection string to point to your computer running SQL Server". I don't know if my SQL Server is running or not and if it is I don't know what would be the name of the server. I know I installed SQL Server when I installed VS 2010 (I did a full installation), so it should be somewhere. I haven't changed anything in the SQL Server configuration so everything should be on what is default.

+2  A: 

If you installed SQL Server along with VS 2010, you have SQL Server 2008 Express edition on your machine, and it is installed by default as a "SQLExpress" instance, so your connection string would have to be something like:

server=(local)\SQLExpress;database=(whatever_you_want);integrated security=SSPI;

This would expect that database you specify to already exist on your server.

If you want to programmatically create a database, you would have to connect to the master database

server=(local)\SQLExpress;database=master;integrated security=SSPI;

and then run a SQL statement something like this from your app:

CREATE DATABASE (newDatabaseName)
marc_s
A: 

You can check under services (start/run/services.msc) whether your SQL server is running or not; or in your start menu under "sql server configuration manager". pls check if named pipes and tcp-ip are enabled.

Dexion