Results 1 to 1 of 1
  1. #1
    Join Date
    Jan 2010
    Posts
    15

    Unanswered: Problem with query

    Here is the error
    Code:
     
    You have an error in your SQL syntax; check the manual that corresponds to your
    MySQL server version for the right syntax to use near '%m-%d %H:%i:%s') as in_ti
    me_dscr,  date_format(p.stockout_time,'%Y-%m-%d %H:%i:%' at line 1
    got within VS, while this is the script
    Code:
                    sql = @"select " +
                        " null as row_num, " +
                        " date_format(p.in_time,'%Y-%m-%d %H:%i:%s') as in_time_dscr, " +
                        " date_format(p.stockout_time,'%Y-%m-%d %H:%i:%s') as stockout_time_dscr, " +
                        " date_format(ADDDATE(p.store_rcv_time, " + package_expiry_day_vg.ToString() + "), '%c月%e日') as expiry_date_chi, " +
                        " date_format(ADDDATE(p.store_rcv_time, " + package_expiry_day_vg.ToString() + "), '%D %b') as expiry_date_eng, " +
                        " c_s.sms_addr_eng, " +
                        " c_s.sms_addr_chi, " +
                        " c_s.store_no, " +
                        " p.*  " +
                        " from package_vg p  " +
                        " left join c_store_vg c_s on c_s.dscr = p.store_dscr " +
                        " where p.deleted = '0' " +
                        " and (p.phone like '9%' or p.phone like '6%' or p.phone like '5%') " +
                        " and length(trim(p.phone)) = 8 " +
                        " and c_s.send_sms = 1 " +
                        " and (p.status = 'store_rcv' or p.status = 'store_app_rtn') " +
                        " and p.sms_send = 0 " +
                        " and date_format(p.store_rcv_time,'%Y-%m-%d') >= " + DBUtil.GetSqlString(From_Date.ToString(DBUtil.DATE_FORMAT)) + " " +
                        " and date_format(p.store_rcv_time,'%Y-%m-%d') < " + DBUtil.GetSqlString(To_Date.ToString(DBUtil.DATETIME_FORMAT)) + " " +
                        " order by p.id";
    why?
    Last edited by HuaMin; 07-27-15 at 05:46.
    Many Thanks & Best Regards,
    HuaMin Chen

Posting Permissions

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