如下代码操作,
Adodataset1.CommandText:='insert into service(......)';
Adodataset1.open;
结果报错,我知道错在了使用open参数上,正确方式应该使用什么呢?谢谢

解决方案 »

  1.   

    .excute在adodataset中无效,我使用的是delphi2005
      

  2.   

    没人知道?
    完整出错信息是:commandtext does not return a result set
      

  3.   

    Adodataset的commandtext中只能用select语句,帮助中说的很明白。
      

  4.   

    Use the TADODataSet component's CommandText property to retrieve the dataset, specifying either a table name or an SQL statement (SELECT only). TADODataSet is not capable of issuing Data Manipulation Language (DML) SQL statements that do not return result sets (like DELETE, INSERT, and UPDATE). For this use a component like TADOCommand or TADOQuery.用adoquery
    adoquery1.close;
    adoquery1.sql.clear;
    adoquery1.sql.add('insert into service(......)');
    adoquery1.excute;               //注意不返回结果集 不要open 否则要open