Need to program a connection string for remote access

A

AAaron123

This is in my asp.net program running on my local SQL Server 2008 machine:

<add name="Personal" connectionString="Data Source=Dad;Integrated
Security=True;Initial Catalog=Personal"
providerName="System.Data.SqlClient"/>

<add name="LocalSqlServer" connectionString="Data Source=Dad;Integrated
Security=True;Initial Catalog=AspnetDb"/>



This is what I was told to do for my ISP SQL Express 2008 machine:
Copy the mdf and ldf files from your local machine up to the server.


Say I copy them up to my App_Code directory on the ISP machine (is that a
good place to put them?).

How must I change my connection strings?


Thanks in advance for any help!


PS Any way I could have both sets in my file like:

If remote
use these
Otherwise
use these
 
B

bruce barker

no, use the app_data folder, it was designed for this. then in your
connection string you can:

<add name="MYDB" connectionString="Data Source=.\SQLExpress;Integrated
Security=True;User Instance=True;AttachDBFilename=|DataDirectory|mydb.mdf" />

-- bruce (sqlwork.com)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top