Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Re:Displaying recordset in excel -date sort failing

Status
Not open for further replies.

abhi1024

Programmer
Dec 20, 2003
55
US
I have an asp page and I am using the ContentType method of the Response object to displaying the recordset in excel.The problem I am having is that the excel file generated has everything format type set to general.The recordset generated contains date, and when users are trying to sort the excel file using date,its treating date as general and sorting is failing.
I havent been able to find any help on the internet.Can I cast the field to set it to certain data type
Please help
Thanks
Abhishek
 
I have a dynamically created excel file where the date sort works just fine -

Here's the line from my SQL Server SP

Code:
'<td>' + convert(varchar(20), r.datetimecreate, 1) + '</td>'

It's just text but excel knows to make it a date...

Programming today is a race between software engineers striving to build better and bigger idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. - Rick Cook
zen.gif

 
The problem is when trying to display the recordset in a web page the sort works fine , its just when displaying in excel , it treats date as text .
When I try to format any of the cell in excel , it doesnt seem to let me manually change the type from general to anything (number,text etc
 
Then why dont you sort the records before sending them to excel sheet...

I mean do the sort in the query itself and then display on the excel sheet...

-L
 
I already have a sort option,but the users need to sort more than once
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top