SkonJeet
SkonJeet

Reputation: 4905

Basic database connection and deployment

I've created a database on .\SQLEXPRESS in SSMS.

How do I connect to the database in Visual Studio 2010? I know this is potentially a big question but my main concern is with how I'd construct the connection string. I'd right click in solution explorer and add the database file myself but I can't seem to find where the file is!?

Also, this project is to give to someone else upon completion; if I were to connect to this database how would I deploy it so that the recipient could also run it locally?

Thanks.

Upvotes: 0

Views: 84

Answers (3)

Amar Palsapure
Amar Palsapure

Reputation: 9680

Inside "Server Explorer" connect to the server. Use "Add Connection" with "Microsoft SQL Server (SqlClient)" option give the server name and select the database to connect.

If you are using integrated security your connection string will look like this

Data Source=.\SQLEXPRESS;Initial Catalog=YourDataBaseName;Integrated Security=True

or if you are using user name and password it will be

Data Source=.\SQLEXPRESS;Initial Catalog=YourDataBaseName;User ID=UserID;Password=Password

Hope this helps you.

Upvotes: 1

4b0
4b0

Reputation: 22323

See the link.http://msdn.microsoft.com/en-us/library/fxk9yw1t.aspx

Upvotes: 0

Mitch Wheat
Mitch Wheat

Reputation: 300549

"Data Source=.\SQLEXPRESS;Database=MyDatabase; Integrated Security=True"

Upvotes: 2

Related Questions