Understanding the dataadapter.delete command

I'm new to ADO and ODP so forgive me if I'm missing the obvious. I want to do a simple delete from the database. The problem is I feel like I have to issue the delete command twice. The code I've posted blow works but I don't understand why. I create two commands one a select command the second a delete command. I apply these commands to a dataadapter and then use dataadapter .fill() to get a dataset.
Great it works fine up to this point. The problem was when I called dataadapter.update nothing would happen. The delete command was ignored. So I looped through the resulting dataset and deleted the record from there. Then I called dataadapter.update and it worked. I tried not setting the dataadapter.deletecommand but then update failed.
Now my question is: Is it always necessary to delete from a dataset as well as issue a delete command or is there a way of issuing just one delete command? Is it possible to simplify my code?
Any suggestions or help greatly appreciated.
Drew
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim oradb As String = "Data Source=vulcan.world;User Id=adowling;Password=aragon;"
Dim conn As New OracleConnection(oradb)
Dim cmd As New OracleCommand
Dim cmd2 As New OracleCommand
Dim orada As New OracleDataAdapter
Dim dsLog As New DataSet
Dim drDelete As DataRow
Dim myCol As DataColumn
Dim dcPK(1) As DataColumn
Dim i As Integer
Dim rc As DataRowCollection
Dim pSDEWorkspace As IWorkspaceFactory2
Try
conn.Open()
cmd.Connection = conn
cmd.CommandText = "select * from t.reconcile_log"
cmd.CommandType = CommandType.Text
orada.SelectCommand = cmd
cmd2.Connection = conn
cmd2.CommandText = "delete from t.reconcile_log where objectid = " + TextBox1.Text
cmd2.CommandType = CommandType.Text
orada.DeleteCommand = cmd2
orada.Fill(dsLog, "Reconcile_Log")
orada.MissingSchemaAction = MissingSchemaAction.AddWithKey
myCol = dsLog.Tables("Reconcile_Log").Columns.Item(dsLog.Tables("Reconcile_Log").Columns.IndexOf("OBJECTID"))
dcPK(0) = myCol
dsLog.Tables("Reconcile_Log").PrimaryKey = dcPK
drDelete = dsLog.Tables("Reconcile_Log").Rows.Find(TextBox1.Text)
drDelete.Delete()
orada.Update(dsLog, "Reconcile_Log")
ListBox1.Items.Clear()
rc = dsLog.Tables("Reconcile_Log").Rows
For i = 0 To rc.Count - 1
ListBox1.Items.Add(Convert.ToString(rc.Item(i).Item(0)) + " " + rc.Item(i).Item(1) + " submitted " + rc.Item(i).Item(2) + " on " + rc.Item(i).Item("submitted"))
Next i
Catch ex As OracleException
Select Case ex.Number
Case 1
MessageBox.Show("Error attempting to insert duplicate data.")
Case 12545
MessageBox.Show("The database is unavailable.")
Case 904
MessageBox.Show("invalid type")
Case Else
MessageBox.Show("Database error: " + ex.Message.ToString())
End Select
Catch ex As Exception
MessageBox.Show(ex.ToString)
Finally
conn.Close()
conn.Dispose()
End Try
End Sub

Because the dataset is disconnected from the database. This allows you to load some data (into your dataset), disconnect from the network or whatever, make whatever changes you like and have none of this affect the data in the database until you issue the update.
If you actually want to have your changes applied immediately then you can (assuming your application is constantly connected of course). Don't bother with a dataset/data adaptor at all. For example set up the sql select statement, assign it to a reader, execute the reader, store the rows returned in some custom objects or whatever. Make some changes and then use executeNonQuery to apply the updates, either one at a time or as a batch using array binding. There is a samples folder where you installed ODP.NET, have a look at some of the others.

Similar Messages

  • When do the Ripple Delete  and/or  Join commands become active?

    I have been using Soundtrack Pro for a while, but I have not been able to use the Ripple Delete and Joind commands. Under which conditions do these commands become available? Does the Ripple Delete command work like in FCP? I use ProTools, and I would love Soundtrack to include something like the Shuffle mode, in which removing a section on the Timeline would make the rest of the audio samples on that track move up.
    Is this possible? I know this can be done on the audio editor, but sometimes editing to picture requires doing this on the Timeline.
    Thanks in advance for the help!
    Powerbook G4/G5 1.8 GHz   Mac OS X (10.4.6)  

    Great tip Simon - but do you not find this a bit irritating - that you have to go through this extra process just to perform a ripple delete?
    The other point here, is that if you make two cuts in a clip, and then drag over the timeslice section, even with snapping turned on, it seems easy to me to not pin-point the edit in quite the same way that you do with a simple cut. By dragging over, if you miss the edit point by a fraction, you can end up ripple deleting over the cut you intended to make.
    Sadie does all this with so much more ease in my view... a lot quicker when doing very fast editing. I'm surprised that with a 'pro app' tag, apple haven't gone the extra few yards with STP. Doesn't quite cut it (in my view)
    Ant
    G5 2GHz dual, PowerBook G4   Mac OS X (10.2.x)  

  • Handle same delete command from 2 different sessions!

    Dear All,
    My database is 11gR2. I am in a situation where 2 applications are using the same database. There are times when the same delete command is issued from both applications that hangs the DB. None of the query is successfully executed.
    I want to lock the rows so that the first query executes and while second waits and when first completes second query is executed, though it wont delete any records as records are delete from the first query. But there is no hanging situation. Should I lock the table before running the query? or i first select the records using for update?
    Kindly help on this.
    Regards,
    Imran

    Thanks, The details are:
    Actually my applications are the 2 radius servers that are again getting requests from BRAS server. BRAS issues a delete command to radius server 1, if radius server is busy and takes longer then 3 seconds to respond BRAS issues the same command to radius server 2. When the same command from 2 different servers executes on the DB there is kind of dead lock, when this situation happens I have to terminate session of any one radius server and then the other query gets executed.
    I understand that Oracle takes care of this automatically but in my situation my DB is under tremendous load and sometimes I have to terminate sessions.
    Its a simple delete command with some selection. I hope this helps a bit.
    Regards, Imran

  • ISE delete command 80 character limitation

    Hello Guys,
    one of our customers did a backup to local disk on the ISE. Later he tried to remove the file on the ISE node by running the delete command. Unfortunately the name of the file exceeded the 80 character limitation of the CLI delete command.
    Is there any other opportunity to get rid of the backup file?

    I haven't run into this before but it sounds like a bug Here is what I would recommend:
    1. ISE 1.1.2 just came out so you can upgrade your system and see if that takes care of the problem
    2. If #1 does not fix the issue then you should probably contact TAC and get a root patch installed to gain root level access to the system. Once you have root access you can do pretty much whatever you like including deleting that file. After the issue is resolved request the TAC engineer to file a defect with the development team so they can fix this in the future release
    Thank you for rating!

  • I still don't totally understand the difference on my iPhone between PhotoStream (with iCloud icon), Photos (the icon) and Albums and Camera Roll (under Photos icon) and and Camera Roll (under Camera icon).  I want to delete photos from my iPhone 4.

    I  don’t  understand the difference on my iPhone between PhotoStream (with iCloud icon), Photos (the icon) and Albums and Camera Roll (under Photos icon) and and Camera Roll (under Camera icon).  They seem to be more or less the same thing, but deleting photos in one place does not delete them elsewhere.
    When I tried to import from my camera to my iMac computer the computer would not recognized 900 of the 920 photos on the camera so I had to (successfully) use the Image Capture application to import them.
    I want to delete photos from my iPhone 4 in order to free up storage (I only have 8GB.)  But in synching I do not want to delete any images from my iPhoto on my computer.
    Is there a way that I can Delete All under Edit in either Photos or Camera on my iPhone and check about 20 ijmages to remain on the iPhone?  I could find no command to Select All and then uncheck the 20 photos I want to keep.
    I have the 8GB iPhone and the iMac with OS 10.9.2 and iPhoto '09 Version 8.1.2.
    Help!

    I have Version 6.1.3 because the clogged storage will not allow me to upload Version 7.1.  Catch 22.  This is basically a storage issue, I believe.  I cannot delete enough stuff on my iPhone to allow me to either back up or upload the new OS 7.  I am unwilling to pay for more storage in iCloud, so I want to delete stuff I don't need.  But I haven't yet figured out how to successfully do that.  I synch my phone and computer.  I want to delete mail on the Mail app and photos and still keep my photos on my computer on iPhoto, but not on my phone.  I seem unable to do that.  Any advice?

  • Skip the DELETE command on logical standby

    Hi All,
    I want to skip the DELETE command on logical standby.
    DB Version - 10.2
    OS - Linux
    Primary DB and logical standby DB .
    In our DB schema some transaction tables. We delete data from those tables by delete commands.
    Delete command, also delete data from logical standby DB. But we want to skip on logical standby DB .
    I use following for that and get error.
    ALTER DATABASE STOP LOGICAL STANDBY APPLY;
    EXECUTE DBMS_LOGSTDBY.SKIP (stmt =>'DELETE TABLE', schema_name =>'TEST',object_name =>'TRANS',proc_name => null);
    ALTER DATABASE START LOGICAL STANDBY APPLY IMMEDIATE;
    But I got error
    ERROR at line 1:
    ORA-06550: line 1, column 7:
    PLS-00306: wrong number or types of arguments in call to 'SKIP'
    ORA-06550: line 1, column 7:
    PL/SQL: Statement ignored
    When I change stmt =>'DELETE TABLE' to stmt =>'DML', no error happen
    Please help me to solve this issue . This is urgent.
    Thanks in advance.
    Regards

    Dear aditi2,
    Actually it is so simple to understand the problem. Please read the following documentation and try to understand the SKIP procedure.
    http://download.oracle.com/docs/cd/B14117_01/appdev.101/b10802/d_lsbydb.htm#997290
    *SKIP Procedure*
    Use the SKIP procedure to define filters that prevent the application of SQL statements on the logical standby database.
    By default, all SQL statements executed on a primary database are applied to a logical standby database.
    If only a subset of activity on a primary database is of interest for application to the standby database,
    you can use the SKIP procedure to define filters that prevent the application of SQL statements on the logical standby database.
    While skipping (ignoring) SQL statements is the primary goal of filters,
    it is also possible to associate a stored procedure with a DDL filter so that runtime determinations can be made whether to skip the statement,
    execute this statement, or execute a replacement statement.
    Syntax
    DBMS_LOGSTDBY.SKIP (
         stmt                      IN VARCHAR2,
         schema_name               IN VARCHAR2,
         object_name               IN VARCHAR2,
         proc_name                 IN VARCHAR2,
         use_like                  IN BOOLEAN,
         esc                       IN CHAR1);Hope That Helps.
    Ogan
    Edited by: Ogan Ozdogan on 30.Tem.2010 13:03

  • Understanding the Delete Applet APDU

    Hello all,
    I'm trying to understand each byte of the delete APDU command.
    I'm using this guide as a reference: http://askra.de/software/jcdocs/kit-user-2.2.1/cJDKinstaller.html#wp8960
    My delete command is the following:
    80 C4 01 00 08 07 (AID - 7 sets)
    Is this understanding correct? When I run the command after selecting the applet, I receive a 6D00 response, stating the command structure is not supported.
    Thanks,
    Collin

    I see you said: When I run the command after selecting the applet, I receive a 6D00 response, stating the command structure is not supported.
    you must select the security domain/cardmanager, then send the delete command

  • HELP!  Is there a way to change column information in iTunes such as name of artist, genre etc, other than deleting them one at a time? Such as the way you delete an entire group of songs by holding down control keys or selecting the Select All command.

    HELP!  Is there a way to change column information in iTunes such as name of artist, genre etc, other than deleting them one at a time? Such as the way you delete an entire group of songs by holding down control keys or selecting the Select All command. Thanks.

    If you select all the songs you want to change, Be it one song or an akbum, or an Artist, Or Genre, or playlist. Then Right mouse click  and Get Info. You then get a slightly different from normal Get Info box as this is the One for Multiple items.
    In there have a look at the tags and see if the one you want to changes is in there. There are a few tabs so if for example you wanted to change the Media Type from Home Movie to Movie go to the Options tab and select Movie and OK and it will change the whole selection.

  • TS1135 Low quality warning on a photo in a photobook. I understand the warning but I still want to go ahead with my design, will it get printed or will the page be deleted?

    Low quality warning on a photo in a photobook. I understand the warning but I still want to go ahead with my design, will it get printed or will the page be deleted?

    Sorry 1 further question please..
    the  pixel width is 1,076 and heigth is 793 and I want to have this photo as a background in a 13 x 10 inch book
    Will this be ok?
    Thanks

  • I updated my iMac to Mountain Lion. All the files were deleted. I have Time Machine backups. When I restart the mac pressing Command R to restore from backup it shows the previous OS X (Leopard) beside the date of the backup. Will it go back if I restore?

    I updated my iMac to Mountain Lion. All the files were deleted. I have Time Machine backups. When I restart the mac pressing Command R to restore it from the backup it shows the previous OS X (Leopard) beside the date of the backup that I want to select. Will it go back to Leopard if I restore it from the backup?

    No, it won't revert to the prior OS X but you you may have third party apps installed that were compatible with Lion that may not be compatible with Mountain Lion.
    App Compatibility Table - RoaringApps - App compatibility and feature support for OS X & iOS
    After you restore from TM, check HD > Incompatible Software

  • How to filter the "delete" command in oracle streams ?

    How to filter the "delete" command in oracle streams ? (oracle 9i R2 )
    Message was edited by:
    user507013

    Hello
    write a procedure doing "nothing" for delete transcation :
    connect adminstrm/..
    CREATE OR REPACE PROCEDURE write_delete_lcr (
    message IN SYS.ANYDATA,
    error_stack_depth IN NUMBER,
    error_numbers IN DBMS_UTILITY.NUMBER_ARRAY,
    error_messages IN EMSG_ARRAY )
    AS
    s_id sys.anydata ;
    ad SYS.ANYDATA;
    lcr SYS.LCR$_ROW_RECORD;
    ret PLS_INTEGER;
    vc VARCHAR2(30);
    apply_name VARCHAR2(30) ;
    errlog_rec log_errors%ROWTYPE ;
    ov2 SYS.LCR$_ROW_LIST;
    BEGIN
    return;
    End;
    for your apply do :
    BEGIN
    DBMS_APPLY_ADM.SET_DML_HANDLER(
    object_name => TABLE_NAME,
    object_type => 'TABLE',
    operation_name => 'DELETE',
    error_handler => true,
    user_procedure => 'write_delete_lcr',
    apply_database_link => NULL);
    END;
    Hafedh KADDACHI
    Oracle DBA

  • I accidentally deleted the toolbar and command bar and everything that is above the tabs. How do I get it back?

    I accidentally deleted everything above the tabs: toolbar, command bar etc. and now I have no idea how to get it back. Can anyone please help me?
    == User Agent ==
    Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; Trident/4.0; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; OfficeLiveConnector.1.3; OfficeLivePatch.0.0; .NET CLR 3.5.30729; .NET CLR 3.0.30618; AskTB5.6)

    The command bar in IE is situated to the right of the tabs. They include the following:- HOME, NO FEEDS DETECTED, READ MAIL, PRINT, PAGE, SAFETY, TOOLS, and ? This command bar is missing in Mozilla Fire Fox. There is a download called VISTA-AERO but it appears to be incompatible in Fire Fox. To me the command bar is useful so I miss it.
    The menu bar is totally different to the command bar. That sits to the top left of the screen. It seems to me from the answers that are posted refer to the menu bar. The way that the answers are written are helpful to those that lose the menu bar but is not helpful to the people who are missing the command bar.
    I, like the others who miss the command bar would like a solution to obtaining a compatible command bar in Fire Fox please. Any body have any suggestions please.

  • Does any one know the hot key / command to hard delete from an external Drive

    Does any one know the hot key / command to hard delete from an external Drive (i.e. delete direct without having to put in trash first)?

    Nothing happens on a hard drive that doesn't involve the computer.
    Here's a list of all the keyboard shortcuts. I don't see anything such as you have described, so perhaps you once used a keyboard macro or have not described what you mean properly.

  • I have Mac mini and there is partition of boot camp but some miss understanding the osx 10.8.2 is deleted and while I m going to recovery mode the portition can not removing and the also cant repaired what I do I need urgent help ???? Please ?????

    I have Mac mini and there is partition of boot camp but some miss understanding the osx 10.8.2 is deleted and while I m going to recovery mode the portition can not removing and the also cant repaired what I do I need urgent help ???? Please ?????

    Do you have a Time Machine backup or clone?  If not,
    all is lost if you have in fact deleted your OSX partition
    and you will have to do a reinstall from Recovery HD
    and install all else.

  • How do I delete an exception made by clking "I understand the risk?"

    Was going to new website and got the untrusted message and accidentally click "I understand the risk." How to I reverse this? I do NOT trust this site.

    hi robinandjon, you can undo that when you go into the ''menu > options > advanced > certificates > view certificates > servers'' tab and delete the cert of the site in question.

Maybe you are looking for