locked
SqlDataSource: DataSet versus DataReader RRS feed

  • Question

  • User1899595498 posted

    Which one is faster for web performance between two setup below?

    • SqlDataSource as DataSet with EnableCaching is True. 
    • SqlDataSource as DataReader (no caching capability).

    The consideration is only on the web performance, and ignore the other factors. Please advise.

    Thanks.

    Friday, January 14, 2011 8:40 AM

Answers

All replies

  • User541108374 posted

    Hi,

    Please advise.

    Measure! Plain and simple, create 2 pages and grab the same data. Each page holds one of the 2 ways. Also make sure that you create an extra warming up page that hits the database so that both your application and SQL are spinning already.

    Grz, Kris.

    Friday, January 14, 2011 8:56 AM
  • User1899595498 posted

    I am a beginner for ASP.NET. How do I measure? <?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p>

    Is there a tool in Visual Studio 2008 Standard Edition to measure it?<o:p></o:p>

    Do you have link subject that explain more detail how to measure it?<o:p></o:p>

    Please advise.<o:p></o:p>

    Thanks.<o:p></o:p>

     

    Friday, January 14, 2011 4:01 PM
  • User541108374 posted

    Hi,

    make use of the Stopwatch class. Start it in the SqlDatasource Selecting event and stop it in the SqlDatasource Selected event (those are pre- and postevents of the actual select statement (http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.sqldatasource_events.aspx). Then use a Literal control of which you set the Text property to the amount of elapsed milliseconds of the stopwatch: http://msdn.microsoft.com/en-us/library/system.diagnostics.stopwatch.aspx.

    Grz, Kris.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Saturday, January 15, 2011 3:59 AM
  • User3866881 posted

    It just depends on the current situation: I think if you want to do a batch updating with less data. DataSet is your best friend.

    However, if you only want to see (view) records, DataReader will be your best choice. 

    Sunday, January 16, 2011 9:32 PM