select 日期 from 表单1将第一条日期记录赋给s1 第二条给s2 第三条给s3 一直到s9  如果没有9条就赋空值,而不出现异常。

解决方案 »

  1.   

    用CASE语句了啊,在第9条时做个判断就可以了
      

  2.   

    谢谢helldream2002()能具体一些吗?
      

  3.   

    select date() from table_1
    if date().count<=9 then
    begin
    while (not eof) and i<=9 do
    begin
    s[i]:=date()[i].values;
    i:=i+1;
    next;
    end;
    end;
    if date().count<=8 then
    begin
    ..
    s[9]:=nil
    end;
    s[9]=
    第9條
      

  4.   

    s[i]:=date()[i].values;  这一句该怎么理解呢? s[i]:=query1[i].values; 可以吗?该如何写呀??
      

  5.   

    ado.close;
    ..select date from table
    ado.open;
    i:=1;
    ado.first;
    while (not ado.eof ) do
    begin
      case i of
        1: s1:= ado.fieldbyname('date').asstring;
        2: s2:= ado.fieldbyname('date').asstring;
        3: s3 := ado.fieldbyname('date').asstring;
        ...
        9: s8:=ado.fieldbyname('date').asstring;
      end;
      inc(i);
      ado.next;
    end;
    end;
    不知道你要那么多S1,S2,...s3干嘛我只好这么写了,不知道数组可不可以,如果可以那样更好了
    这样就可以了,如果有第9条就有值,没有就是你的初使值空了,这个我没有测试,只是提供一个方法你自已去试一下!