代码如下
procedure TForm1.FormShow(Sender: TObject);
begin
Memo1.Clear;
datasource1.DataSet:=adotable1;
dbgrid1.DataSource:=datasource1;
adotable1.TableName:='studentinfo';
adotable1.open;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
adoquery1.SQL.Clear;
adoquery1.SQL.Add(memo1.Text);
adoquery1.ExecSQL;
adotable1.Refresh;
end;
dataset设置的是adotable1,执行sql语句的是adoquery1,在Memo1中输入sql语句刷新显示的是adotable1,为什么啊

解决方案 »

  1.   

    adoquery1执行更新了数据库,adotable1在refresh不是把新数据取出来了吗,他们俩肯定操作的是一个数据库表
      

  2.   

    "在Memo1中输入sql语句刷新显示的是adotable1"不太明白你的意思。 Memo1中显示字符串“adotable1” 还是显示adotable1表中的记录?看上述代码,Memo1中除了你输入的SQL命令,不应该再显示其它内容,因为没有给Memo1赋值的语句。