Local delete with ADODataSet

Hi all,

There´s a disconnected ADODataSet with local fields.
A ADOStoredProc gets the recordset and assign it to the ADODataSet:

....
ADODataSet.CreateDataSet;
ADODataSet.Recordset := ADPStoredProc.Recorset;
ADODataSet.Connection := nil;
....

Them problem is that when call ADODataSet.Delete the delete command is
sent to the database and the records are deleted.
I need to delete this records only in the recordset to be possible
to cancel this changes.

I guess the "ghost connection" is comming to the ADODataSet by the second
line ADODataSet.Recordset := ADPStoredProc.Recorset; that´s the reason of
the third line (that´s is not working as well).

I´m using the ADODataSet.Delete; command by just tried ...recordset.delete(); too.

How can I prevent to sent the delete command to the database?

Best regards,

Luciano RM
0
Luciano
12/16/2008 3:25:03 AM
embarcadero.delphi.ado 597 articles. 1 followers. Follow

3 Replies
1418 Views

Similar Articles

[PageSpeed] 16

Luciano Rodrigues skrev:
> 
> How can I prevent to sent the delete command to the database?

Assign nil to ADOStoredProc.Connection before ADODataSet.Recordset := 
ADPStoredProc.Recorset;

BTW you don't need ADODataSet.CreateDataSet;

regards

/Micke
0
Mikael
12/16/2008 11:58:36 AM
Hi Micke,

It worked but got a new problem, it uses the following code to update records in the database:

        DataSource.DataSet := nil;
        ADODataSet1.FilterGroup := fgPendingRecords;
        ADODataSet1.Filtered := True;
        ADODataSet1.First;
        while not ADODataSet1.Eof do
        begin
           if ADODataSet1.RecordStatus = [rsDeleted] then // or rsNew, etc
           ...

This filtering is not working anymore, it was fine before.
I believe it worked just bacause the active connection.

Best regards,

Luciano RM

> {quote:title=Mikael Eriksson wrote:}{quote}
> Assign nil to ADOStoredProc.Connection before ADODataSet.Recordset := 
> ADPStoredProc.Recorset;
> 
> BTW you don't need ADODataSet.CreateDataSet;
> 
> regards
> 
> /Micke
0
Luciano
12/16/2008 6:43:28 PM
Luciano Rodrigues skrev:
> This filtering is not working anymore, it was fine before.
> I believe it worked just bacause the active connection.

ADOStoredProc1.LockType has to be ltBatchOptimistic

/Micke
0
Mikael
12/17/2008 8:02:01 AM
Reply:

Similar Artilces:

delete local $a[$idx]
I've just pushed a "deletelocal" branch to the repository that contains the implementation of "delete local $a[$idx] - delete local $h{$key}". This syntax was actually valid for a long time (at least since 5.6) but didn't do anything. Following a suggestion from Ricardo, I've made it equivalent "delete $a[$idx]; local $a[$idx]", except that it returns the value before the localization. There are no changes to the grammar. The optree changes are minimal (now OP_DELETE also accepts OPpLVAL_INTRO). It works for (?:arrays|hashes) (?:references)? ...

Convert Delphi 5 ADO App to Delphi 2007 ADO.NET
I have an appliction tha that is writen in Delphi 5 with ADOConnetion, ADOTable, and ADOQuery components. I need to upgrade to Delphi 2007 and use ADO.NET. I have the program building in with Delphi 2007. Is there anything I need to do to convert the ADO to ADO.NET? > I need to upgrade to Delphi 2007 and use ADO.NET. Why ? -- With best regards, Dmitry Arefiev AnyDAC (www.anydac.com) - Oracle, MS SQL Server, IBM DB2, MySQL, Firebird, Interbase, PostgreSQL, Sybase ASA, SQLite, MS Access, DBX, ODBC, InMem - universal high-speed native data access engine Reasons for ...

ADODataset.insert and ADODataset.delete
The underlying table accessed with ADODataset1 is indexed and ADODataset is sorted (ascending) on this index. I have the following loop scanning over the entire dataset: for I := 0 to ADODataSet1.RecordCount - 1 do begin if I = 0 then begin ADODataSet1.First; end else begin ADODataSet1.Next; end; // Do_something (update, insert or delete); end; Say that I have some consecutive records with indexes 3, 5, 7, 9 While record 5 is current I decide to delete this record. Will record 7 automatically become the new current rec...

Delete message from server when deleted locally
Hi. In my pop mail account, properties-->server settings, there is a check box to 'delete from server when deleted locally or moved from inbox'. Is there a way to change this to two separate check boxes? one that says: delete message from server when moved from inbox and another that says: delete message from server when deleted locally i don't want to delete the message when i move it, only when i delete it locally from my deleted folder (so if i accidentally delete it, i can recover it and it wont be deleted from the server! Joe On 6/29/06 1...

Delphi 6 to Delphi 2010 upgrade and ADO
We have an application written in Delphi 6 Professional that uses ADO to access databases servers that may be on other PCs in our network. We want to move to Delphi 2010 but can't decide if we need Professional or Enterprise. 2010 Pro has dbGO - will this give us the same functionality as the ADO components we use in Delphi 6 Pro? Thanks, Keith > 2010 Pro has dbGO - will this give us the same functionality as the > ADO components we use in Delphi 6 Pro? Yes. > {quote:title=Joachim Uersfeld wrote:}{quote} > > 2010 Pro has dbGO - will this give us the same func...

ASA7 ADO & Delphi ADO ?? Anyone is using it?
Any comments? Is it working? Any Problems? Thanks Hi, PR <noemail@no.com> schrieb in im Newsbeitrag: BoTThJaq$GA.89@forums.sybase.com... > Any comments? Is it working? Any Problems? I tried to connect to ASA7 via the new OLE DB - Provider and ADOExpress from Delphi 5.01. No chance. Only the error message 'Invalid Enum Value'. About the new provider I haven't heard anything good until now... Regards Frank Frank, I've experienced the same problem with the ASA 7 OLEDB Provider. I'm not sure if this is a bug in the AsaProvider or Delp...

Deletes are not being deleted.
Using ASA 7.03 I am having a problem in deleting field service orders that have been completed. Just getting started with sync so I am probably making a dumb mistake or just leaving out a step. The download_delete_cursor script is: Select ordernumber from ServiceOrderEntryMaster where Tech = ? and Order_Complete = 'Y' This based on the verbose reply from the MobiLink Synchronization server is picking the correct work order ( number 326 ) and showing a Delete Row line in the log. But the work order is not being deleted on the remote side. What could I be doing wron...

ANN: Localizer 4.1.0
We are glad to announce Localizer 4.1.0 release. Localizer is a localization/globalization tool kit for applications written in CodeGear (Borland) Delphi or C++ Builder . Using it you can get one executable file that supports as many languages as you want. Localizer can process all string resources in your project: properties of components on forms, resource string constants, VCL messages and messages from third-party packages. You can also change size and position of the controls in different languages. Support fo additional language(s) can be added without recompilation of t...

ANN: Localizer 4.3.0
We are glad to announce Localizer 4.3.0 release. Localizer is a localization/globalization tool kit for applications written in CodeGear (Borland) Delphi or C++ Builder. Using it you can get one executable file that supports as many languages as you want. Localizer can process all string resources in your project: component properties, resource string constants, VCL messages and the messages from the third-party packages. You can also change size and position of the controls in different languages. Support fo additional language(s) can be added without recompilation of the p...

ANN: Localizer 4.0.0
We are glad to announce Localizer 4.0.0 release. Localizer is a localization/globalization tool kit for applications written in CodeGear (Borland) Delphi or C++ Builder . Using it you can get one executable file that supports as many languages as you want. Localizer can process all string resources in your project: properties of components on forms, resource string constants, VCL messages and messages from third-party packages. You can also change size and position of the controls in different languages. Support fo additional language(s) can be added without recompilation of the projec...

ANN: Localizer 3.8.1
Hello, We are glad to announce Localizer 3.8.1 release. Localizer is a localization/globalization tool kit for applications written in CodeGear (Borland) Delphi or C++ Builder . Using it you can get one executable file that supports as many languages as you want. Localizer can process all string resources in your project: properties of components on forms, resource string constants, VCL messages and messages from third-party packages. You can also change size and position of the controls in different languages. Support fo additional language(s) can be added without recompil...

Delphi XE4 LIbrary Path
The Library path editing dialog in Tools Options has for some time now had a button called "Delete Invalid Paths". screenshot: http://i.imgur.com/Wzn7Ib8.png The first item in this library path, in Delphi XE4, due to it being a multi-platform tool, is now more complex than before, it looks like this: $(BDSLIB)\$(Platform)\release However, it appears $(Platform) does not resolve within the context of this dialog box and so it appears grayed out. When users use the Delete Invalid Paths button to remove invalid paths (paths that do not exist), this will delete the most ...

ANN: Localizer 4.6.0
We are glad to announce Localizer 4.6.0 release. Localizer is a localization/globalization tool kit for Embarcadero Delphi or C++ Builder. Using it you can get one executable file that supports as many languages as you want. Localizer can process all string resources in your project: component properties, resource string constants, VCL messages and the messages from the third-party packages. You can also change size and position of the controls in different languages. Support for additional language(s) can be added without recompilation of the project even by your end users. Localiz...

ANN: Localizer 4.1.0
We are glad to announce Localizer 4.1.0 release. Localizer is a localization/globalization tool kit for applications written in CodeGear (Borland) Delphi or C++ Builder . Using it you can get one executable file that supports as many languages as you want. Localizer can process all string resources in your project: properties of components on forms, resource string constants, VCL messages and messages from third-party packages. You can also change size and position of the controls in different languages. Support for additional language(s) can be added without recompilation of the proje...

Web resources about - Local delete with ADODataSet - embarcadero.delphi.ado

Resources last updated: 12/11/2015 6:02:41 AM