kiran vontela

kiran vontela

  • NA
  • 50
  • 11.9k

using 2 datetime picker date range in c# with mysql

Jul 31 2013 5:36 AM
HI I am trying to use this query to retereive results from mysql data table where i choose dates from datetime pickers  but i am not getting the ouptput as required , can you helpme with this.when I try this I get the output on single date but where I required is datewise(daya by day accepted images, rejected images and change images count)

MySqlDataAdapter sda = new MySqlDataAdapter(String.Format(
    "SELECT   datetime ," +
    "sum(CASE action when '2' then 1 else 0 end) as AcceptedIMG, " +
    "sum(CASE action when '3' then 1 else 0 end) as RejectedIMG, " +
    "sum(CASE action when '4' then 1 else 0 end) as ChangeIMG " +
    "FROM customer_1.audit_trail " +
    "where datetime BETWEEN '{0}' and '{1}'",

    start.Value.ToString("yyyy/MM/dd"), 
    end.Value.ToString("yyyy/MM/dd")
), conn)

Answers (43)