close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

ASP Date Sort

Thread began 4/20/2010 8:29 am by bjgarner241692 | Last modified 4/23/2010 8:39 am by Jason Byrnes | 1661 views | 6 replies |

bjgarner241692

ASP Date Sort

I need to sort the records in a WADA_Recordset by the Date Field.

Sorts fine in Access, field is setup as a date field.

When I use ORDER BY ExpiryDate, I get:

12/1/2010
4/15/2010

It is sorting on the 1 in 12 (December) rather than the Month in proper order. Expanded, I'm going to get:

October
November
December
April
August
February .....

I've tried from the recordset and I've tried adding a Server Sort Behaviour but I get the same result. 2 hours of Googling has netted me zero.

Does anyone have a solution? I suspect I need something like dateformat() in the Query but I have no idea what the syntax would be.

Sign in to reply to this post

bjgarner241692

On review, I don't know what this is doing. It's like it is completely ignoring the sort because my results show:

12/31/2010
4/15/2010
10/15/2010
8/1/2010
6/19/2010

That is:

Dec
Apr
Oct
Aug
Jun

Sort should be Ascending:

Apr
Jun
Aug
Oct
Dec

Sign in to reply to this post

Jason ByrnesWebAssist

can you send a copy of your page so I can look at the code?

In a quick test I created an access DB and created a SQL statement to sort by the date column and the results were correct.

I agree with your statement that it is ignoring the ORDER BY clause. to test this, I would write the SQL being used to the screen, If you send a copy of your page, I can give the exact code needed to write the recordset sql to the screen.

Sign in to reply to this post

bjgarner241692

As requested, file attached.
thanks

Attached Files
Renewals_Results.zip
Sign in to reply to this post

Jason ByrnesWebAssist

your recordset does not include an order by clause?:

WADARenewals_cmd.CommandText = "SELECT ID, HomeName, ContactPerson, Feature, PostingDate, ExpiryDate, Address, City, Zip, Prov, Email, Fee FROM Renewals"



maybe try using the format function in the order by clause to force the months to be 2 digits.

try changing that to:

WADARenewals_cmd.CommandText = "SELECT ID, HomeName, ContactPerson, Feature, PostingDate, ExpiryDate, Address, City, Zip, Prov, Email, Fee FROM Renewals ORDER BY Format(ExpiryDate, 'mm/dd/yyyy')"





to write the SQL being used to the screen, add the following after the body tag:
[code]
<%= WADARenewals_cmd.CommandText %>

Sign in to reply to this post

bjgarner241692

I do not understand why or how that is but I most certainly had inserted an ORDER by clause in there and had tested it extensively. I have noticed lots of weird behaviours around recordsets on pages with WA behaviours. You update a recordset, click OK, but it either does not update the code or it inserts a new RS and a new connection string. Perhaps that is what happened.

In any event, it is now sorting with a simple ORDER BY ExpiryDate.

Sign in to reply to this post

Jason ByrnesWebAssist

OK, Glad to hear it is working.

Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...