473,396 Members | 1,722 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

sqlDataReader does not return correct sorted data

Sam
Hi All,

I have a very strange issue with ms sql stored procedure and sqlDataReader
and I hope that someone can tell me what's going on . I have an asp.net
application which has one of its page populated with data onto a datagrid
and recently the records are not sorted correctly on the datagrid(we do all
the sorting in our stored procedure and no sorting on the code behind page).

The strange things is that:

1. It doesn't happen all the time. Some days it does and some it does not
and usually in the morning when we have a high traffic.
2. And while this sorting issue appeared on the page, I ran the stored
procedure that pulls data for the grid with the query analyzer, I get
correct sorted records
3. The third thing is that, when this strange thing happens, if I use the
sql enterprise manager to open the stored procedure and click on ok button,
the datagrid on the page gets correct sorting again and this last for about
couple of days or so. This seems to me that there is something on the sql
server which gets refresh when I click on the OK after viewing the stored
procedure.

Does anyone experience something similar or know where I should looking for
errors? Thanks in advance for your help.

Regards,

Sam
Nov 27 '06 #1
3 2714
Sam,

I was wondering if you are caching the data shown with the datareader.
The page might not be getting data from the database it could showing data
stored in memory which was sorted.

http://msdn2.microsoft.com/en-us/library/6hbbsfk6.aspx

Ken
---------------

"Sam" wrote:
Hi All,

I have a very strange issue with ms sql stored procedure and sqlDataReader
and I hope that someone can tell me what's going on . I have an asp.net
application which has one of its page populated with data onto a datagrid
and recently the records are not sorted correctly on the datagrid(we do all
the sorting in our stored procedure and no sorting on the code behind page).

The strange things is that:

1. It doesn't happen all the time. Some days it does and some it does not
and usually in the morning when we have a high traffic.
2. And while this sorting issue appeared on the page, I ran the stored
procedure that pulls data for the grid with the query analyzer, I get
correct sorted records
3. The third thing is that, when this strange thing happens, if I use the
sql enterprise manager to open the stored procedure and click on ok button,
the datagrid on the page gets correct sorting again and this last for about
couple of days or so. This seems to me that there is something on the sql
server which gets refresh when I click on the OK after viewing the stored
procedure.

Does anyone experience something similar or know where I should looking for
errors? Thanks in advance for your help.

Regards,

Sam
Nov 27 '06 #2
Sam
Hi Ken,

Thanks for your suggestion. I went through the aspx page(s) and I don't see
any places that cache data from the data reader.

"Ken Tucker [MVP]" <Ke**********@discussions.microsoft.comwrote in message
news:C1**********************************@microsof t.com...
Sam,

I was wondering if you are caching the data shown with the datareader.
The page might not be getting data from the database it could showing data
stored in memory which was sorted.

http://msdn2.microsoft.com/en-us/library/6hbbsfk6.aspx

Ken
---------------

"Sam" wrote:
>Hi All,

I have a very strange issue with ms sql stored procedure and
sqlDataReader
and I hope that someone can tell me what's going on . I have an asp.net
application which has one of its page populated with data onto a datagrid
and recently the records are not sorted correctly on the datagrid(we do
all
the sorting in our stored procedure and no sorting on the code behind
page).

The strange things is that:

1. It doesn't happen all the time. Some days it does and some it does not
and usually in the morning when we have a high traffic.
2. And while this sorting issue appeared on the page, I ran the stored
procedure that pulls data for the grid with the query analyzer, I get
correct sorted records
3. The third thing is that, when this strange thing happens, if I use the
sql enterprise manager to open the stored procedure and click on ok
button,
the datagrid on the page gets correct sorting again and this last for
about
couple of days or so. This seems to me that there is something on the sql
server which gets refresh when I click on the OK after viewing the stored
procedure.

Does anyone experience something similar or know where I should looking
for
errors? Thanks in advance for your help.

Regards,

Sam

Nov 27 '06 #3
use an order by in your sql statement, maybe?

sql statements without an order by will frequently provide an
inconsistent sort order

-Susie, DBA
Sam wrote:
Hi All,

I have a very strange issue with ms sql stored procedure and sqlDataReader
and I hope that someone can tell me what's going on . I have an asp.net
application which has one of its page populated with data onto a datagrid
and recently the records are not sorted correctly on the datagrid(we do all
the sorting in our stored procedure and no sorting on the code behind page).

The strange things is that:

1. It doesn't happen all the time. Some days it does and some it does not
and usually in the morning when we have a high traffic.
2. And while this sorting issue appeared on the page, I ran the stored
procedure that pulls data for the grid with the query analyzer, I get
correct sorted records
3. The third thing is that, when this strange thing happens, if I use the
sql enterprise manager to open the stored procedure and click on ok button,
the datagrid on the page gets correct sorting again and this last for about
couple of days or so. This seems to me that there is something on the sql
server which gets refresh when I click on the OK after viewing the stored
procedure.

Does anyone experience something similar or know where I should looking for
errors? Thanks in advance for your help.

Regards,

Sam
Nov 27 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Adie | last post by:
Hi, just looking for tips and ideas from the experienced. I wondered if you guys encapsulate the SqlDataReader so as to allow simpler code with less duplation, if so what does your code look like...
7
by: Franck Diastein | last post by:
Hi, when I call ExportData I have this error: Invalid attempt to Read when reader is closed. Telling me that there's a problem with this line: while(_dataR.Read()){ Code:...
1
by: Neo Chou | last post by:
Greetings! I met the same question as in ADO a few months ago. I'm working on MS SQL Server 2000. I have a stored procedure that returns a return value as well as a record set (by "select"...
4
by: Michael Carr | last post by:
I have a function that populates a class with values from a database. I'd like to pass into the function either a SqlDataReader or a DataRow, depending on which mechanism I'm using to retrieve data...
4
by: Griff | last post by:
The MSDN article: Developing high-performance ASP.NET applications recommends using the SqlDataReader above using DataSets. One of the advantage of using DataSets over DataReaders is (as I...
8
by: bidllc | last post by:
I have a funtion that works fine and dandy when called from anywhere in my app. It will NOT work when called from inside the class in which it resides. This is the function I'm calling:...
3
by: TomislaW | last post by:
how to pass values betwen data and busines tier using SqlDataReader. I was thinking about ArrayLists but what if I have number of rows and columns?
3
by: dchristjohn | last post by:
I am currently developing a small windows application using Visual Basic via Visual Studio 2005. My database resides on a SQL 2000 server. I have a table with three fields: id (int, Not Null)...
3
by: rn5a | last post by:
A SqlDataReader is populated with the records from a SQL Server 2005 DB table. The records retrieved depends upon 2 conditions (the conditions depend on what a user selects in an ASPX page). If...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.