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?

3
  • You could take a look at EFProf. Commented Mar 12, 2012 at 11:39
  • Use the SQL Server Profiler on the SQL Server machine - it'll show you all the details about all the SQL statements . Commented Mar 12, 2012 at 12:29
  • stackoverflow.com/questions/3586736/… Commented Mar 12, 2012 at 13:42

1 Answer 1

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.

Sign up to request clarification or add additional context in comments.

1 Comment

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.