你是不是指要把
query1.ParamByName('A').asstring:=stringgrid1.Cells[0,j];
  query1.parambyname('B').asstring:=stringgrid1.Cells[1,j];
放在
query1.SQL.Add('update Test1.Test2 set A=:A where B= :B');
这些语句前面?
我现在调过来了,
但仍旧报错为:
param A not find
param B not find

解决方案 »

  1.   

    query1.Close;
      query1.SQL.clear;
      if i=0 then
      query1.SQL.Add('update Test1.Test2 set A=:A where B= :B');
      if i=1 then
      query1.SQL.Add('update Test1.Test2 set B= :B  whereA= :A ');
      query1.ParamByName('A').asstring:=stringgrid1.Cells[0,j];
      query1.parambyname('B').asstring:=stringgrid1.Cells[1,j];
      Query1.Prepare;   //增加此语句
      query1.ExecSQL ;
      

  2.   

    楼上的说的对,你应该加上判断语句
    if(stringgrid1.cells[0,j]!=Query1.fieldbyname("fieldname").asstring;
    {....}
    或者应该在getedittext事件中写代码