我用右键建立一个'新建',试图在grid中新建一列,代码如下:
 UnitDBGrid.ReadOnly:=false;
UnitDBGrid.Options:=UnitDBGrid.Options-[dgRowSelect];
UnitDBGrid.Options:=UnitDBGrid.Options+[dgEditing];
UnitADOQuery.append;
 with UnitADOQuery do
 begin
 close;
 sql.Clear;
 sql.Add('insert into talbe(custno) values('111')');
 open;
 end;
UnitADOQuery.post;
UnitADOQuery.edit;程序运行后弹出错误信息如下:1、project1.exe raised exception class eddatabaseerror with message '单前提供程序不支持从一执行返回多个记录集'.process stopped.use step or continue.2、project1.exe raised exception class eddatabaseerror with message 'unitadoquery:commandtext dose not retun a result set'.process stopped.use step or continue.
请问是什么原因,如何解决,

解决方案 »

  1.   

    1、"insert.." 这个SQL语句,不能用Open,,要用ExecSQLSQL语句的4个DML语句,中"select" 用open
    "insert ,update,delete"这三个用ExccSql这个是基础~~~
      

  2.   

    当ADOQuery中有insert语句>>UnitADOQuery.post;
    >>UnitADOQuery.edit;执行完post之后,就把记录插入到数据库中了,这个时候,就不能调用edit这个方法;只有当ADOQuery用select这个sql语句,查询返回得数据集后,才用edit这个方法,编辑数据
      

  3.   

    UnitDBGrid.ReadOnly:=false;
    UnitDBGrid.Options:=UnitDBGrid.Options-[dgRowSelect];
    UnitDBGrid.Options:=UnitDBGrid.Options+[dgEditing];
    UnitADOQuery.append;
     with UnitADOQuery do
     begin
     close;
     sql.Clear;
     sql.Add('insert into talbe(custno) values('111')');
     exccsql;
     end;
    UnitADOQuery.post;
     这样对吗?我还有一个 GRID也有此表中的字段,能在增加的同时显示出来吗?