Connection String / Data source - Modify script from VWD Express local pc script

Discussion in 'Site Programming, Development and Design' started by Charlie, Mar 21, 2010.

  1. I am very much a newbie ( first attempt to use a host ) but I am uploading pages by ftp and think I have managed to get my data from my PC to Winhost server using Server Management Studio. I think the next step is to adjust my source code to reflect new data source and connection details. . .

    In my CP / MS SQL / Manage - There is a connection string below the DB details.

    Mine is:
    "Data Source=tcp:s02.Winhost.com;Initial Catalog=DB_5554_maindb1;User ID=DB_5554_maindb1_user;Password=******;Integrated Security=False;"

    In my source page, for the web page which will display my datalist, I still have the code used to disply the datalist in VWD 2008 Express debug -
    which is:
    Line 89 <asp:SqlDataSource ID="SqlDataSource1" runat="server"
    Line 90 ConnectionString="<%$ ConnectionStrings:ConnectionString %>"

    If I change the connection string to the new one at my CP I get a Parser Error re Line 90 when visiting page in browser. A correction is offered but when I try it I get an error saying that Line 89 is not well formed.

    I am very grateful if anyone can show me how to make the necessary adjustments for these 2 lines of code.
     
    Last edited by a moderator: Oct 14, 2015
  2. I am the above post's auther - PROBLEM SOLVED.

    For the benefit of any other newbies who may find themselves asking the same question I was:-
    The source code needs only to be changed in your WebConfig file. Near the top you will find your existing connection string. Rather than delete it put it in comment tags / then copy it and paste it just below the original. Now you have duplicate you can delete the existing connection string and replace it with the new connection string ( the one generated by Winhost cp / MS SQL 2008 / manage ). Then save the page and ftp it to your site.
    Once that is done you should then surround that connection string with comment tags and remove comment tags from the original so that your application works as you are used to in debug on your own PC.

    This is starting to get exciting!! :) :)
     
    Last edited by a moderator: Oct 14, 2015
  3. Glad you got it going and thanks for following up.
     
  4. Ray

    Ray

    Don't forget that you can also set the connection string for your .net application using the 'Connection String' module in IIS 7 Manager. This is a simple way to setup your connection string in your applications web.config file without going through the coding.
    Download the IIS 7 Manager from Microsoft. Setup it up to connect to our server.

    http://support.Winhost.com/KB/a628/using-the-microsoft-iis-70-manager.aspx

    Then once you are connected go look for the icon/image that resembles a database, should be labeled 'Connection Strings' and setup your connection string from in there. Its quick and easy.
     
    Last edited by a moderator: Oct 14, 2015
  5. Thanks for posting this info. It was helpful to me.
     

Share This Page