Need to program a connection string for remote access

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • AAaron123

    #1

    Need to program a connection string for remote access

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

    <add name="Personal" connectionStrin g="Data Source=Dad;Inte grated
    Security=True;I nitial Catalog=Persona l"
    providerName="S ystem.Data.SqlC lient"/>

    <add name="LocalSqlS erver" connectionStrin g="Data Source=Dad;Inte grated
    Security=True;I nitial Catalog=AspnetD b"/>



    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




  • Mark Rae [MVP]

    #2
    Re: Need to program a connection string for remote access

    "AAaron123" <aaaron123@road runner.comwrote in message
    news:eJeLJYpOJH A.1368@TK2MSFTN GP06.phx.gbl...
    How must I change my connection strings?
    I would strongly suggest that you use a Web Deployment Project:


    Among many other things, this will allow you to have separate web.config
    sections (including connection strings) for your local machine and your
    ISP...


    --
    Mark Rae
    ASP.NET MVP


    Comment

    • =?Utf-8?B?YnJ1Y2UgYmFya2Vy?=

      #3
      RE: Need to program a connection string for remote access

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

      <add name="MYDB" connectionStrin g="Data Source=.\SQLExp ress;Integrated
      Security=True;U ser Instance=True;A ttachDBFilename =|DataDirectory |mydb.mdf" />

      -- bruce (sqlwork.com)


      "AAaron123" wrote:
      This is in my asp.net program running on my local SQL Server 2008 machine:
      >
      <add name="Personal" connectionStrin g="Data Source=Dad;Inte grated
      Security=True;I nitial Catalog=Persona l"
      providerName="S ystem.Data.SqlC lient"/>
      >
      <add name="LocalSqlS erver" connectionStrin g="Data Source=Dad;Inte grated
      Security=True;I nitial Catalog=AspnetD b"/>
      >
      >
      >
      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
      >
      >
      >
      >
      >

      Comment

      Working...