Go Back   CodingForums.com > :: Server side development > ASP.NET

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 04-23-2013, 03:42 AM   PM User | #1
ema486
New to the CF scene

 
Join Date: Apr 2013
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
ema486 is an unknown quantity at this point
ASP.NET MYSQL HELP: How to filter datagrid using two datepickers

Please help me, I have been stuck on this all day!!

I am wanting to filter results of wpf datagrid using two datepickers. My query i have so far is as follows

Code:
MySqlConnection cs = new MySqlConnection(connectionSQL);
cs.Open();
 
DataSet ds = new DataSet();
 
MySqlDataAdapter da = new MySqlDataAdapter("Select * from Transactions WHERE date BETWEEN '"+datePicker1.Text +"' AND '"+datePicker2.Text +"' ", cs);
 
MySqlCommandBuilder cmd = new MySqlCommandBuilder(da);
 
da.Fill(ds);
 
this.dataGrid1.ItemsSource = ds.Tables[0].DefaultView;
My code has no errors but the dataset returns as empty even though I have got records which correspond to query.


Does datepicker require any binding in xaml? DBase date field has type of date. and saves dates with this format 2013-03-11
ema486 is offline   Reply With Quote
Old 05-06-2013, 02:07 PM   PM User | #2
annaharris
New Coder

 
Join Date: May 2012
Location: USA
Posts: 92
Thanks: 0
Thanked 6 Times in 6 Posts
annaharris can only hope to improve
What are the fields that your require to display after filtering the data as per the datepickers ?
annaharris is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

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 On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 06:44 AM.


Advertisement
Log in to turn off these ads.