sql server - framework 4 - IIS 7 weird sort from db to page
SOLVED - look below at the end of the explanation
I am experiencing a strange behavior when reading a resultset from database in a calling method. The sort of the rows is different from what the database should return.
My farm:
- database server: sql server 2008 on a WinServer 2008 64 bit - web server: a couple of load balanced WinServer 2008 64 bit running IIS 7 The application runs on a v4.0 app pool, set to enable 32bit applicationsHere's a description of the problem:
- a stored procedure is called, that returns a resultset sorted on a particular column - I can see thru profiler the call to the SP, if I run the statement I see correct sorting - the calling page gets the results, and before any further elaboration logs the rows immediately after the SP execution - the results are in a completely different order (I cannot even understand if they are sorted in any way)Some details on the Stored Procedure:
- it is called by code using a SqlDatAdapter - it has also an output value (a count of the rows) that is read correctly - which sort field is to be used is passed as a parameter - makes use of temp tables to collect data and perform the desired sortAny idea on what I could check? Same code and same database work correctly in a test environment, 32 bit and not load balanced.
SOLVED - it was a problem in the stored procedure logic; in the last select I had an inner join towards a column, and the resulting sort (but only in the production db) was on that field, descending, instead开发者_运维知识库 that on the desired column. Modified the logic, now everything works. I still have to understand where is the real reason of this behavior only on one database and not against the other. Maybe some indexes...
精彩评论