哪位大侠帮忙解决一下
解决了,一定给分
是不是我说的不是很清楚呢?
问题归根到底就是如何处理类型为ftArray的参数
其他类型的参数没有问题,就是这个ftArray类型不知如何处理

解决方案 »

  1.   

    var
      Param: string;
    begin
      Param := 'select id from table2';
      sqldataset.commandtext := Format('select * from table1 where id in (%s)', [Param]);
      sqldataset.open;
    end;SQL语句中多中Format直接生成SQL语句,而不是多用参数。:-)
    end;
      

  2.   

    sqldataset.commandtext:='select * from "employee" where "eno" in (:param_eno)';
    看看这样可以么?
      

  3.   

    你的方法是行不通的。
    1. 为什么所有Datatype的前面都有ft,因为它实际上是TFieldType type(字段类型)。
    2. 所以除非你的字段本身是ftArray类型,否则会出错。按你的写法,实际上是要一个整型字段的值(eno)和一个数组型字段的值(param_eno)比较,判断前者是否在后者之中,当然类型不匹配。
    3. 解决方法:'select * from employee where eno in (:param1,:param2,:param3...))'  //param1,2,3... 的类型同eno  如果你的参数可以从别的表里选出来:'select * from employee where eno in (select eno from OtherTable where ...)'不失为一个好方法。