topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Friday March 29, 2024, 2:16 am
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: Restoring Visual Studio Data Sources  (Read 3964 times)

fearoffours

  • Participant
  • Joined in 2009
  • *
  • Posts: 2
    • View Profile
    • Donate to Member
Restoring Visual Studio Data Sources
« on: February 23, 2009, 09:04 AM »
Hello there, Although I am an amateur coder with a small amount of experience with a variety of languages, I'm having trouble with Visual Studio and a .NET web application.

I'm a web admin for a local garden centre. Up until recently I have been responsible for the content of our e-commerce site, which has been hosted by the company who built and designed the site. This is managed through a custom CMS.

Recently, we cut the design and maintenance ties with the company who built the site, although they continue to host and provide support. I received a copy of the website and it's associated MS SQL database.
Navigating the code in Visual Web Developer Express Edition 2008 is not a problem. ANd after a little poking around I have successfully configured a local connection to the database. However, the application does not appear to display information from the database. None of the data sources appeared to be configured.
In design view, any pages which pull information from the database have the controls visible without the data. Clicking on the '>' on an active datalist/datagrid brings p the Tasks dialog. No Data Source is displayed in the drop down box. I can manually step through the process of choosing a new data source , and choose what appears to be the appropriate stored procedure for the control, but I do get a bit lost when asked to define cookie and session parameters for the SQL statement.
Shouldn't the data source procedure be stored within the code? Connections between the database and the web app are not being made, how can I easily restore them? (I do have a connection to a local copy of the website listed in the database explorer window)
The website is in ASP.NET with C# behind and an MS SQL 2005 database.
Thanks to anyone who can help


fenixproductions

  • Honorary Member
  • Joined in 2006
  • **
  • Posts: 1,186
    • View Profile
    • Donate to Member
Re: Restoring Visual Studio Data Sources
« Reply #1 on: February 23, 2009, 09:28 AM »
2fearoffours
Check Web.Config file, there should be something like this inside:
Code: Text [Select]
  1. <connectionStrings>
  2. <add name="MyTestBase" connectionString="Data Source=SQL2005.HostedWindows.pl;Initial Catalog=myowndb;Persist Security Info=True;User ID=XXX;Password=YYY" providerName="System.Data.SqlClient"/>
  3. </connectionStrings>

Moving database hosting from one server to another should require changing connection strings only. This "trick" worked for me twice :)

I recommend to take a look here:
http://www.connectionstrings.com/

CWuestefeld

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 1,009
    • View Profile
    • Donate to Member
Re: Restoring Visual Studio Data Sources
« Reply #2 on: February 23, 2009, 10:05 AM »
fenix is exactly right. However, it is recommended that you not do it this way: anyone that can hack into access into your server (including the hosting provider, who has legitimate access) can see your password. You should look at ways of encrypting this data. Try searching on CodeProject.com for "encrypt connection string". (This site can probably give you additional help with the connection string itself)

fearoffours

  • Participant
  • Joined in 2009
  • *
  • Posts: 2
    • View Profile
    • Donate to Member
Re: Restoring Visual Studio Data Sources
« Reply #3 on: February 23, 2009, 11:11 AM »
Thanks very much to both of you! Is there any form of reputation system here?
I was sure I had the connection string right, but your replies made me investigate further, ann yes, now they are correct! Many thanks.
I'm reliably informed that the connection strings are encrypted on the server. But this is of little consequnce as I obviously did not make it clear I was having trouble with my local development copy. The web.config file on the server is never overwitten unless a specific change is needed.