不同的数据库SQL语句格式略有不同,若是SQL Server试试这么写: with CDS_MB do begin Close; sqla := 'DELETE FROM TMB_MB_INFO WHERE ID=11111 '; CommandText := sqla ; try Execute; finally Close; end;
若是在Execute后ApplyUpdates ,则系统报错:Cannot perform this operation on a closed dataset. 若是在Open后ApplyUpdates,则系统在Open时就已报错:Error creating cursor handle。但是不管怎么操作,记录还是没删掉。当然,这个SQL语句在SQL Explorer 中可以正常执行并得到正确的结果。高手们请一定帮忙。
1、SQL没有执行
2、条件写错了
跟踪一些,服务端的执行过程
with CDS_MB do begin
Close;
sqla := 'DELETE FROM TMB_MB_INFO WHERE ID=11111 ';
CommandText := sqla ;
try
Execute;
finally
Close;
end;
若是在Open后ApplyUpdates,则系统在Open时就已报错:Error creating cursor handle。但是不管怎么操作,记录还是没删掉。当然,这个SQL语句在SQL Explorer 中可以正常执行并得到正确的结果。高手们请一定帮忙。