0

I'm using ADO.NET Entity Framework for our business application in ASP.NET website. We're using WCF and LINQ to query the data source. My problem is that data loading from database (for e.g. to load data in gridview) is taking much more time than expected, so we want to log statements in ado.net generated sql statement so we can see which query is taking more time .

How to do this?

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
D S
  • 258
  • 9
  • 25

1 Answers1

1

I would strongly suggest that you use SQL Profiler rather than creating your own logging mechanisms.

Microsoft SQL Server Profiler is a graphical user interface to SQL Trace for monitoring an instance of the Database Engine or Analysis Services. You can capture and save data about each event to a file or table to analyze later. For example, you can monitor a production environment to see which stored procedures are affecting performance by executing too slowly.

In your C# application, in your ConnectionString, add Application Name=yourApp. This will make it easier to locate in SQL Profiler.

Neil Knight
  • 47,437
  • 25
  • 129
  • 188
  • Actually I'm not able to finding SQL profile (Starts -> All Programs _>Microsoft Sql 2008 , Performance tools is not present ) . I'm using SQl Management Studio 2008 Express, any other way to tracing ADO.NET generated SQL query. – D S Mar 15 '12 at 09:14