Need to program a connection string for remote access

Discussion in 'ASP .Net' started by AAaron123, Oct 30, 2008.

  1. AAaron123

    AAaron123 Guest

    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
     
    AAaron123, Oct 30, 2008
    #1
    1. Advertising

  2. AAaron123

    bruce barker Guest

    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)


    "AAaron123" wrote:

    > 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
    >
    >
    >
    >
    >
     
    bruce barker, Oct 30, 2008
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. vighnesh
    Replies:
    1
    Views:
    5,560
    Landley
    Sep 29, 2005
  2. Kathryn Bean
    Replies:
    1
    Views:
    688
    John Harrison
    Oct 28, 2004
  3. Replies:
    2
    Views:
    1,680
    James Irvine
    Mar 24, 2007
  4. TomaszC
    Replies:
    1
    Views:
    1,085
    Salt_Peter
    Nov 17, 2008
  5. Replies:
    5
    Views:
    314
    Xho Jingleheimerschmidt
    Mar 7, 2009
Loading...

Share This Page