OraQuery How to .UpdateBatch
OraQuery How to .UpdateBatch
OraQuery How to .UpdateBatch like adoquery.UpdateBatch?
//q:toraquery;
opensql:='select CODE,XM,DZ from A1 where CODE is NULL';
if q.Active then q.Close;
q:=openquery(opensql,psession);
self.DataSource1.DataSet:=q;
q.ReadOnly:=false;
q.LocalUpdate:=false;
for i :=1 to 100 do // Iterate
begin
q.AppendRecord([InttoStr(i),'XXXX,'111']);
end; // for
q.CachedUpdates:=true;
q.ApplyUpdates;
Is there someting wrong? It noticed that "can't modify a read-only dataset".
opensql:='select CODE,XM,DZ from A1 where CODE is NULL';
if q.Active then q.Close;
q:=openquery(opensql,psession);
self.DataSource1.DataSet:=q;
q.ReadOnly:=false;
q.LocalUpdate:=false;
for i :=1 to 100 do // Iterate
begin
q.AppendRecord([InttoStr(i),'XXXX,'111']);
end; // for
q.CachedUpdates:=true;
q.ApplyUpdates;
Is there someting wrong? It noticed that "can't modify a read-only dataset".
Set CachedUpdates = True before opening the dataset.
If you are using ODAC version before 6.0, TOraQuery component is read-only unless you have set the SQLInsert property. You can you the TSmartQuery component instead of TOraQuery. TSmartQuery generates INSERT statement automatically.
If you are using ODAC version before 6.0, TOraQuery component is read-only unless you have set the SQLInsert property. You can you the TSmartQuery component instead of TOraQuery. TSmartQuery generates INSERT statement automatically.
Code: Select all
SmartQuery.SQL.Text := 'select CODE,XM,DZ from A1 where CODE is NULL';
SmartQuery.CachedUpdates := True;
SmartQuery.Open;
for i := 1 to 100 do
begin
SmartQuery.AppendRecord([InttoStr(i),'XXXX,'111']);
end;
SmartQuery.ApplyUpdates;
SmartQuery.CommitUpdates;