Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Basics
Password Reminder
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
ASP.NET 2.0 Basics If you are new to ASP or ASP.NET programming with version 2.0, this is the forum to begin asking questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Basics section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old January 20th, 2007, 08:43 PM
Authorized User
Join Date: Nov 2005
Location: Morisset, NSW, Australia.
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Default Filter dataset by Date?

I have a datagrid displaying entries by users showing user, amount of time, date entered, and description bound to a dataset. Im trying to filter the dataset on the DateTime column but get an error. Here's the code:
private void dgSummaryFilter(string SortColumn, string strFilter)
            // Apply filter to the Job Summary dataset, enable button to remove filter, and bind Job Summary datagrid
            if (SortColumn=="TimeStamp")
                Global.dsJobSummary.Tables[0].DefaultView.RowFilter = SortColumn + " = " + strFilter;
                Global.dsJobSummary.Tables[0].DefaultView.RowFilter = SortColumn + " LIKE '*" + strFilter + "*'";
                dgSummary.DataSource = Global.dsJobSummary.Tables[0].DefaultView;

Im pretty sure its to do with the filter string on the datetime column. How do i concatenate the string?
Reply With Quote
  #2 (permalink)  
Old January 23rd, 2007, 07:17 PM
Authorized User
Points: 333, Level: 6
Points: 333, Level: 6 Points: 333, Level: 6 Points: 333, Level: 6
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Apr 2005
Location: Fresno, California, USA.
Posts: 94
Thanks: 0
Thanked 0 Times in 0 Posts

Hmm, looks like it should work but I will drop just a few suggestions you could try.

For concatentating the date, you will have to put it into a DateTime object class and then output it with the "YourDateTimeObject.ToShortDateString()" method to get the short date format which should be MM/DD/YYYY.

Next, I don't know for sure but do you need a pair of single tickets encapsulated by quotes around your strFilter on the line above the one that looks for the wildcard? I haven't really filtered from the dataset. I read somewhere that the app server isn't built for that and should be best left to SQL if you have a lot of EU.

Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Help for Select SQL Query with date filter pushpa SQL Server DTS 0 February 6th, 2007 10:06 AM
Filter form with date fields problem!! chiefouko Access 2 August 14th, 2006 10:15 AM
Macro/Date/Advanced Filter alexyss15 Excel VBA 1 March 30th, 2006 01:06 PM
sql date filter keyvanjan Classic ASP Databases 3 March 8th, 2006 10:17 PM

All times are GMT -4. The time now is 10:07 AM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.