数据库中的xs_date是datetime格式的。gdate:=trim(gzdate_cb.Text);sqlstr:='select sp_name,sp_type ,manu,c_price,xs_quantity from sp_xs where (xs_state=''挂帐'')and(cus_name='''+customer_cb.Text+''')and(xs_date=''+gdate+'')';我应该怎样改才行呢?请教!!!

解决方案 »

  1.   

    gdate:=trim(strtodate(gzdate_cb.Text));sqlstr:='select sp_name,sp_type ,manu,c_price,xs_quantity from sp_xs where (xs_state=''挂帐'')and(cus_name='''+customer_cb.Text+''')and(xs_date=''+gdate+'')';
    应该就可以了
      

  2.   

    sqlstr:='select sp_name,sp_type ,manu,c_price,xs_quantity from sp_xs where (xs_state=''挂帐'')and(cus_name='''+customer_cb.Text+''')and(xs_date='''+gdate+''')';
      

  3.   

    lz上面记得是三个单引号,怎么下面就成两个了?
    另外,你在将语句送往服务器执行之前可以考虑先showmessage一下看看你到底是将什么语句送过去了