红色的是提示出错的地方
const arro :Array [1..8] of string = ('id1','id2','id3','id4','id5','id6','id7','id8');
var tempInt:string;
    tempint1:string;
     i:integer;
     j:integer;
     ArrT :Array [1..8,1..8] of string;
begin
for i:=1 to 8 do
begin
for j:=1 to 8 do
begin
ArrT[i,j]:=('+arro[i]+'+'+arro[j]+');
tempint1:=arro[i];
tempint:=arro[j];
with adoquery1 do
begin
close;
sql.Clear;
sql.add('insert into '+edit1.text+'(item ,num) select "arrt[i,j]", sum(tempint) from test where tempint1=1 and tempint=1');
adoquery1.Parameters.ParamByName('tempint').Value := tempint;
adoquery1.Parameters.ParamByName('tempint1').Value := tempint1;
open;
end;
end;
end;
end;

解决方案 »

  1.   

    少了个 : 号.sum(:tempint) 
    ...
    :tempint1 = 1 and tempint = 1
      

  2.   

    sql.add('insert into '+edit1.text+'(item ,num) select '''+arrt[i,j]+''', sum(:tempint) from test where :tempint1=1 and :tempint=1' group by '+arrt[i,j]+');后面open; 改为ExecSql
      

  3.   


    颜色用错了
    加:是当参数使用,后面再赋值,一般在SQL语句中常用到sql.add('insert into '+edit1.text+'(item ,num) select '''+arrt[i,j]+''', sum(:tempint) from test where :tempint1=1 and :tempint=1' group by '+arrt[i,j]+');
      

  4.   

    发现自己把单引号放错地方了,改正一下:
    sql.add('insert into '+edit1.text+'(item ,num) select '''+arrt[i,j]+''', sum(:tempint) from test where :tempint1=1 and :tempint=1 group by '+arrt[i,j]+'');
      

  5.   

    ArrT[i,j]:=('+arro[i]+'+'+arro[j]+'); 这是什么意思?
      

  6.   

    问题已经解决了,其实可以直接用'+arro[i]+'来使用数组的值,不需要用到变量,不过还是感谢楼上的大哥