SQL.Add('select SaleInfo.ProductID,ProductInfo.ProductName,ProductInfo.PriceIn,Discount,QuantitySale,PriceSale,PriceTotal,DateSale');
    SQL.Add(' from SaleInfo,ProductInfo');
    SQL.Add(' where SaleInfo.ProductID=ProductInfo.ProductID and SaleInfo.ProductID in (select ProductID from SaleInfo) and SaleInfo.DateSale=#'+FormatDateTime('yyyy"-"mm"-"dd ',DateTimePicker1.Date)+'# and TimeSale=#'+FormatDateTime('hh":"mm":"ss',StrToTime(Trim(StringGrid1.Cells[8,Ri])))+'#');

解决方案 »

  1.   

    其实应该是最后一句吧TimeSale=#'+FormatDateTime('hh":"mm":"ss',StrToTime(Trim(StringGrid1.Cells[8,Ri])))+'#为何有错呢,各位帮帮忙吧!!
      

  2.   

    SaleInfo.DateSale=#'+FormatDateTime('yyyy-mm-dd',DateTimePicker1.Date)+'# and TimeSale=#'+FormatDateTime('hh:mm:ss',StrToTime(Trim(StringGrid1.Cells[8,Ri])))+'#');
      

  3.   

    在BDE中设置日期格式为yyyy-mm-dd,或者把日期格式划成BDE缺省的格式以/分割
      

  4.   

    日期格式在别的地方可以正常运行,是不是时间的格式出了问题?
    报错时也是说is not a valid time。
      

  5.   

    Trim(StringGrid1.Cells[8,Ri])是不是这个出问题了呀