473,382 Members | 1,526 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,382 software developers and data experts.

Reverse meaning of null in DataView

mdb
I have a datagrid that is bound to a DataView, and it shows events and the
times that event started ("StartTime") and stopped ("EndTime"). If the event
has started but hasn't finished, then "EndTime" is null. When multiple lines
are displayed in the datagrid, if I sort by EndTime, then the null values end
up sorted incorrectly - they are sorted as if 'null' is minimum - but I need
them to sort as if 'null' is maximum...

Any suggestions? I cannot sort by StartTime (the description above is
simplified).

--
-mdb
Nov 17 '05 #1
2 1738
JV
I can't think of any simple way to do this offhand. A couple of approaches
off the top of my head:

1) in your select statement the builds the data that the dataview is
pointing to, add a calculated column which is a number specifying the sort
order. In your SQL statement it should not be difficult to set all null
fields to sort order 1million or something. Then when your grid sorts on
that column, have it actually sort by the hidden sort order column.

2) Manually sort the data yourself into another data structure and bind to
that instead
"mdb" <m_b_r_a_y@c_t_i_u_s_a__d0t__com> wrote
I have a datagrid that is bound to a DataView, and it shows events and the
times that event started ("StartTime") and stopped ("EndTime"). If the
event
has started but hasn't finished, then "EndTime" is null. When multiple
lines
are displayed in the datagrid, if I sort by EndTime, then the null values
end
up sorted incorrectly - they are sorted as if 'null' is minimum - but I
need
them to sort as if 'null' is maximum...

Any suggestions? I cannot sort by StartTime (the description above is
simplified).

--
-mdb

Nov 17 '05 #2
I don't know how datagrids work, but if they use a sql query, try:

SELECT * FROM [table] ORDER BY isnull( endTime getdate() + 1)

- Steve

"mdb" <m_b_r_a_y@c_t_i_u_s_a__d0t__com> wrote in message
news:Xn****************************@207.46.248.16. ..
I have a datagrid that is bound to a DataView, and it shows events and the
times that event started ("StartTime") and stopped ("EndTime"). If the
event
has started but hasn't finished, then "EndTime" is null. When multiple
lines
are displayed in the datagrid, if I sort by EndTime, then the null values
end
up sorted incorrectly - they are sorted as if 'null' is minimum - but I
need
them to sort as if 'null' is maximum...

Any suggestions? I cannot sort by StartTime (the description above is
simplified).

--
-mdb

Nov 17 '05 #3

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

Similar topics

59
by: Raymond Hettinger | last post by:
Please comment on the new PEP for reverse iteration methods. Basically, the idea looks like this: for i in xrange(10).iter_backwards(): # 9,8,7,6,5,4,3,2,1,0 <do something with i> The...
8
by: xiao zhang yu | last post by:
me was sorry if this question are present before DotNet, no matter VB.Net or C# all they are compiled to IL, and yes, that IL will totally same as "open-sourse", every IL will easy to decompile...
3
by: R. Rajesh Jeba Anbiah | last post by:
Unfortunately, I couldn't find any way to traverse the object array in reverse order. I'd thought there must be a way to do it with for..in loop, but couldn't find anything yet. Could someone...
11
by: Neo | last post by:
Hi Frns, Could U plz. suggest me how can i reverse a link list (without recursion)??? here is my code (incomplete): #include<stdio.h>
15
by: TC | last post by:
What does it mean for an integer to have a null value? I am trying to use the DataView.Find method. That method has an integer return type which contains the "index of the row in the DataView...
3
by: Thirsty Traveler | last post by:
I have a gridview where the datasource is bound after a selection. The result of doing this is that sorting and paging do not work. I was given a sample of how to resolve this, however my attempt...
41
by: rick | last post by:
Why can't Python have a reverse() function/method like Ruby? Python: x = 'a_string' # Reverse the string print x Ruby: x = 'a_string' # Reverse the string
3
by: Paez | last post by:
Hi there. Anybody knows if is it possible to reverse a dataset? Lets say, if the dataSet has 10 rows, row 1 will row 10 and row 10 will be 1 and so on... Thanks in advance. Paez
2
by: cmrchs | last post by:
Hello, I have a GridView and an objectDataSource <asp:GridView ID="GridView1" runat="server" DataSourceID="ObjectDataSource1" AllowPaging="True" /> <asp:ObjectDataSource...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.