1.我想用updown1和updown2来选时间,updown1连edit1,updown2连edit2,该怎么设置edit显示的格式为时间呢
2.怎么设置条件语句呢.
begin
  adoquery1.close;
  adoquery1.SQL.Clear;
  adoquery1.SQL.Add('select *from 产品列表 where 时间 like :时间');
  adoquery1.Parameters.ParamByName('时间').value :=   //怎么写呢.
  adoquery1.Open;

解决方案 »

  1.   

    with ADOQuery4 do
    begin
        Close;
        SQL.Clear;
        SQL.Add('select A39.*,A01.A0190,A01.A0101 from A39,A01');
        sql.add(' and A393 >=:A and A393<=:B');
        Parameters.ParamByName('A').Value:=formatdatetime('yyyy-mm-dd',dtp3.DateTime);
       Parameters.ParamByName('B').value:=formatdatetime('yyyy-mm-dd',dtp4.DateTime);
      Open;
    end;
      

  2.   

    1,delphi无自带控件 你可以用RZ系列的DBTIMEEDIT或者其他  不行的话你直接用datetimepicker得了2.  adoquery1.close; 
      adoquery1.SQL.Clear; 
      adoquery1.SQL.Add('select *from 产品列表 where 时间 like :时间'); 
      adoquery1.Parameters.ParamByName('时间').value :=  formatdatetime('yyyy-mm-dd',dtp3.DateTime). 
      adoquery1.Open;
      

  3.   

    1.我想用updown1和updown2来选时间,updown1连edit1,updown2连edit2,该怎么设置edit显示的格式为时间呢
    答:你可以用datetimepicker控件来获取你要的时间,将其中的KIND属性设置成dtkTime;如果你想精确到秒的话,就在format属性栏中输入HH:mm:ss注意HH一定要大写!
    2.怎么设置条件语句呢.

    begin
      adoquery1.close;
      adoquery1.SQL.Clear;
      adoquery1.SQL.Add('select *from 产品列表 where 时间 like :时间');
      adoquery1.Parameters.ParamByName('时间').value :=  //怎么写呢.
    答:这个地方看你的数据库中时间是什么数据类型了,如果是时间型那就直接写datetimepicker.time。但是我觉得你这个地方的写法有点问题,查询的话能这样用么?我没有试过不知道。但是下面这样是可以的我试过:把你的去掉,这样写
    begin
      updown1:=timetostr(datetimepicker1.time);
      updown2:=timetostr(datetimepicker2.time);
      adoquery1.close;
      adoquery1.SQL.Clear;
      adoquery1.SQL.Add('select *from 产品列表');
      adoquery1.SQL.Add('where 时间 between'+''''+updown1+' and '+''''+updown2+'''');
      adoquery1.open;
    end;