Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Apr 2013
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    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

  • #2
    Regular Coder
    Join Date
    May 2012
    Location
    USA
    Posts
    101
    Thanks
    0
    Thanked 7 Times in 7 Posts
    What are the fields that your require to display after filtering the data as per the datepickers ?


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •