Number of total select statement for particular web page?

I was wondering what is the easiest way to see total number of database queries from my ASP.Net (.NET 2.0) application.

My application heavily use sql 2005 database because all data are dynamic and everything goes through one connection string in web.config. Connection pooling is enabled there.

  • Parameterized dynamic sql query
  • Handling Web Service Timeouts While Performing Long-Running Database Tasks
  • SQL Server: get all previous values that are within half year of a month (not in future)?
  • How to calculate distance between multiple points in SQL Server?
  • Insert into a temp table from a stored procedure on Sql Server 2000
  • Is this sufficient to prevent query injection while using SQL Server?
  • So, I am wondering how many select statements are executed for particular page I load in my browser.

    I don’t care if I can see that information from .net side or from db side as long as I can see only connections to MY database. Not all connections to that db server because I use shared db server and there is a lot of other databases.

  • How to catch the exit code of a CMDEXEC SQL Server Job?
  • SQL Server 2008 Full Text Search (FTS) versus Lucene.NET
  • Unit testing with identity columns
  • SQL Server 2014 performance - parameterized SQL vs. literals
  • SQL: Select dynamic column name based on variable
  • MYSQL equivalent of MS-Access function first() last()
  • 6 Solutions collect form web for “Number of total select statement for particular web page?”

    The best way to do this is to set up a profiler on your database and then make a single request to your ASP.NET application. The profiler will aggregate any data you wish and you will be able to use that data to determine what queries were sent to SQL Server from your application.

    The SQL Server Profiler will list all actions performed on your DB. If you use a different db login name for your project (probably a really good idea if you are not) you can filter so it only shows actions from your login (see Events Selection, Column Filters then Login Name).

    Use SQL Profiler. You can configure it to filter by the database you want and to just show select statements.

    If you have some sort of database layer in your code, you could modify it to write out a log message every time you run a select statement. Then just load the page once and count the number of log statements. This may or may not work, depending on how your code is structured, but it’s an option.

    Edit: I misread the question. I thought you had multiple clients connecting to the same database, not the same database server. In that case, a profiler probably is the best choice.

    Do you have access to SQL Server Profiler? You can set up traces to monitor this sort of thing by loading a page and looking at the effects in the profiler.

    JUst be aware that Profiler can affect performance, so it is best to do this on dev.

    MS SQL Server is a Microsoft SQL Database product, include sql server standard, sql server management studio, sql server express and so on.