SQLDataReader - Extremely poor performance
Hi Guys,
I am new to ASP .NET and ADO, I have a stored proc doing a select query based on parameters from user input (drop down lists, etc.) If I run the code on the MS SQL Server mgmt studio, the query only does about 200 reads (is fairly well tuned as my background is on Business Intelligence).
When the code is run by my ASP .NET 2.0 page over 9000000 reads are performed, I took the code performing the query out of my page ran it standalone on a new page.
Even if all I do is:
string conn;
SqlParameter[] prams = {...Add params according to user input on form...};
SqlDataReader odr = SqlHelper.ExecuteReader(conn, CommandType.StoredProcedure, "myStoredProc", prams);
myReader.Close();
The code still des the same massive number of reads, even if I don't do anything programmatically to the dataset and close the connection immediately as above.
I have run out of ideas, and have tried DataSet, DataAdapter, SQLDataSource on the aspx code, etc...
Some perform better (SqlDataSource for example) but they all do a ridiculous amount of reads in comparison to the procedure executed on the mgmt studio client, any idea why??
Many thanks,
M.
|