TADOQuery.Open 执行一条语句,但仅执行一次
我使用此代码将行从 Table1 复制到 Table2,但它给了我
命令文本不返回结果集
ADOQuery1.Close;
ADOQuery1.SQL.Clear;
ADOQuery1.SQL.Add('insert into Table1');
ADOQuery1.SQL.Add('select Field1 ,Field2 from Table2');
ADOQuery1.SQL.Add('where ArtNo= 1');
ADOQuery1.Open;
ADOQuery1.Refresh ;
如果我不使用
ADOQuery1.Open;
它给我
ADOQuery1:无法对封闭数据集执行此操作。
它复制了我想要的内容,但只复制了一次。如何复制多次?谢谢。
I use this code to copy row from Table1 to Table2, but it gives me
Command Text does not return a result set
ADOQuery1.Close;
ADOQuery1.SQL.Clear;
ADOQuery1.SQL.Add('insert into Table1');
ADOQuery1.SQL.Add('select Field1 ,Field2 from Table2');
ADOQuery1.SQL.Add('where ArtNo= 1');
ADOQuery1.Open;
ADOQuery1.Refresh ;
If I don't use
ADOQuery1.Open;
it gives me
ADOQuery1: Cannot perform this operation on a closed dataset.
It copies what I want but only once. How to copy many times? Thank you.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
对于不打开游标的脚本(例如插入、更新或执行脚本),请使用 TADOQuery 的 ExecSQL 方法。
它返回一个整数,表示查询影响的行数。
For scripts that do not open a cursor (like insert, update or exec ones) use the ExecSQL Method of TADOQuery.
It returns a Integer representing the number of affected rows by your query.