Creating Connection String to Remote DB Server

JaedenRuiner

Well-known member
Joined
Aug 13, 2007
Messages
340
Programming Experience
10+
Well,

I've been using my system with SQLExpress for testing my application and development, but for deployment the Sql Server will be on a networked system.

VB.NET:
Expand Collapse Copy
Data Source=.\SQLEXPRESS;AttachDbFilename=C:\db\rexamship.mdf;Initial Catalog=rexamship;Connect Timeout=30;User Instance=False

that is the connection string I have been using for my test setup, and with a ConnectionStringBuilder() object, I am able to add in the User Name/Password at Run-Time in order to maintain security, etc.

However, my initial issue is with the "AttachDbFilename" parameter, which Frankly, I won't know Where the actual .mdf will be on the server, as well, many times (in the wizard at least) it won't let you attach to a "unc share path".

SO granted that I have the Datasource, (we'll say for the example its "MyServer\SQLEXPRESS") and the DataBase within that server is called "Rexamship" how would I format the connection string to connect to the right server/db without that AttachDbFilename parameter?

thanks
 
Select your server, database & other connection options and it will return to you the needed connection string.

connect.jpg


serverbrowser.jpg


options.jpg
 
Back
Top