Search code examples
.netsqlsql-server-2005-express

Find out which website page are connected to SQL databases or instances


Is there a way to find out which parts of my different websites are connected to which SQL databases and/or tables? (database and websites were not built by me)

I want to know that page "whatever.aspx" is connected to the SQL instance "dbo.Whatever". Is there a way to do that?


Solution

  • There are two ways I can think of doing this:

    1. If you have a list of tables names from your database you can search your .aspx or corresponding .aspx.cs code for references them. This will tell you which database a web page is using.
    2. You can also search for connection strings in your web.config file and then find references to those connection string in your .aspx or corresponding .aspx.cs pages.

    Note: Every page in your .aspx or corresponding .aspx.cs code that connects to a database must use a connection string (or a reference to a connection string in the web.config). It might be time consuming but you can build a map of which pages connect to which databases by looking for references to tables or connection strings.