Need to program a connection string for remote access

  • Thread starter Thread starter AAaron123
  • Start date Start date
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
 
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)
 
Back
Top