adoconnnection1.begintrans;
with adoquery1 do
     begin
     Sql.Text := 'insert into table(a, b) values(:a, :b)';
     Parameters.ParamByName('a').value :='a';
     Parameters.ParamByName('b').value :='b';
     ExecSql;
     end;
adoconnnection1.committrans;adoquery1与adoconnection 连接都正确
单步执行,进行了向数据库插入操作,但就是插入不到数据库中,为什么?
数据库用oracle
还要其他设置不?

解决方案 »

  1.   

    with adoquery1 do
         begin
         close;
         sql.clear;
         Sql.Text := 'insert into table(a, b) values(:a, :b)';
         Parameters.ParamByName('a').value :='a';
         Parameters.ParamByName('b').value :='b';
         ExecSql;
         end;
      

  2.   

    我close了,也清空了,调试也通过,我想用参数方式要不要设置其他地方?
      

  3.   

    看看这个:
    if Not adoconnection1.Connected then
      adoconnection1.Connected := True;
    adoconnection1.begintrans;
    with adoquery1 do
         begin
         Close;
         Sql.Clear;
         Sql.Add('insert into tbl(a, b) values(:a, :b)');
         Parameters.ParamByName('a').value :='a';
         Parameters.ParamByName('b').value :='b';
         ExecSql;
         end;
    adoconnection1.committrans;
      

  4.   

    to firefox2000(网际流浪者,我是如下
       DataMDataBase.ADOConnection1.BeginTrans;
        with TadoQuery.Create(self) do
        begin
          Connection := DataMDataBase.ADOConnection1;
          close;
          sql.Clear;
          Sql.Text := 'insert into table(a, b) values(:a, :b)';
          Parameters.ParamByName('a').value :='a';
          Parameters.ParamByName('b').value :='b';
          ExecSql;
        end;
         DataMDataBase.ADOConnection1.CommitTrans;
    但是不行,我想是不是需要刷新参数?
      

  5.   

    用的什么数据库?你的表名Table不会是关键字吧!
    Prepare一下?看不出有什么问题!
      

  6.   

    还有我是 从bde转为ado保存不料了,在BDE下可以保存,怎回事?