with sql2 do
         begin
            sql.Clear;
            sql.Add('select top 20 * from mulu where (bookid not in (select top :B bookid from mulu)) and (booktype1=:B)');
            //sql.Add(query1);
            sql2.Params.ParamValues['A']:=20*i-1;
            sql2.Params.ParamValues['B']:=str1;
            sql2.Open;
         end;
出现这样的错误:Internal Application Error
SQL 错误: 影射失败错误 --------------------------------------------------------------------------------
/pages

解决方案 »

  1.   

    sql.Add('select top 20 * from mulu where (bookid not in (select top :B bookid from mulu)) and (booktype1=:B)');
    2个参数都是B?可能是这个地方吧
      

  2.   

    with sql2 do begin
      sql.Add('select top 20 * from mulu where (bookid not in (select top :B bookid from mulu)) and (booktype1=:B)');
      with Parameters do begin
        CreateParameters('A', ftInteger, pdInput, 0, NULL);
        CreateParameters('B', ftString, pdInput, 10, NULL);  // 10换成你的实际长度
        ParamValues['A']:=20*i-1;
        ParamValues['B']:=str1;
      end;
    end;
      

  3.   

    我的观点就是你把
        sql.Add('select top 20 * from mulu where (bookid not in (select top :B bookid from mulu)) and (booktype1=:B)');
    这句话中的:b换成实际的数字试试可以吗?
    要是可以的话呢?就是不支持这种格式的了
      

  4.   

    另:参数 A 在那里???你的 SQL 语句是否错??
      

  5.   

    top最好+一个order by//说不定是这个问题
      

  6.   

    在sql里面是通过的啊。。就是写在代码里面有问题。
      

  7.   

    with sql2 do
             begin
                Close;//这里加一句看看
                sql.Clear;
                sql.Add('select top 20 * from mulu where (bookid not in (select top :B bookid from mulu)) and (booktype1=:B)');
                //sql.Add(query1);
                sql2.Params.ParamValues['A']:=20*i-1;
                sql2.Params.ParamValues['B']:=str1;
                sql2.Open;
             end;