Logo 
Search:

Asp.net Forum

Ask Question   UnAnswered
Home » Forum » Asp.net       RSS Feeds

Getting the time for the Number of records retrived

  Asked By: Thelma    Date: Feb 06    Category: Asp.net    Views: 960
  

I have a Library Table and I search for the books in
this table.Now I want to Display to the Client how
much time the Application took to search the book he
had requested for.Can anyone Suggest a Solution?

Share: 

 

1 Answer Found

 
Answer #1    Answered By: Kristen Chavez     Answered On: Feb 06

Off the top of my head , perhaps, at a guess,


void Page_Load(Object Src,EventArgs E) {
string strConn ="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" +
Server.MapPath("dbase3.mdb") + ";";
string strSQL ="select * from Factory1 order by Period";

OleDbConnection Conn = new OleDbConnection(strConn);
OleDbCommand Cmd = new OleDbCommand(strSQL, Conn);
Conn.Open();
OleDbDataReader Rdr;
Rdr=Cmd.ExecuteReader(); ---- 1
MyDataGrid.DataSource = Rdr; ---- 2
MyDataGrid.DataBind();

looking at what we have above, I don't really know ? It executes the reader and then sets the datasource, the true time  would be when the reader is executed to when the datasource is filled (well here its a reader and doesn't actually get filled, but normally its an a adaptor that gets filled).

Perhaps After Execute Reader then start the clock.
Get into the DataBind() function by somehow extending the datagrid, or overridding it or something, and, assuming that the framework will only execute DataBind when there's something to bind to, then stop the timer immediately inside DatBind().

The other alternative is to chuck out a 3 dps random number  between 0 and 0.3 ... who'd know, eh ? half the world makes up their counters anyway, they don't even increment when you refresh.

 
Didn't find what you were looking for? Find more on Getting the time for the Number of records retrived Or get search suggestion and latest updates.




Tagged: