Changes commited to the database only after I update OracledataAdapter twice

Hi. I am using oracledataadapter to manage the data which is eventually displayed in winform datagridview (Visual Studio 2012)
everything works fine , but I have to click "Save" buttin twice to see the changes in the database (Oracle express 11g)
Can you please advice....
Here is my code
it is very simple
1. Obtain connection
2. Create dataadapter
3. Create commands
4. Fill the datatable and dataset
public partial class Concordance : Form
        OracleDataAdapter setupAdapter;
        DataSet projDataset;
        OracleConnection conn;
        //binding sources
        BindingSource setupBindingSource = new BindingSource();
        DataTable setupTable;
        public Concordance()
            InitializeComponent();
            //load tables
            loadSetup();
        //setup table
        private void loadSetup()
            string oradb = ConfigurationManager.ConnectionStrings["OpenU"].ConnectionString;
            conn = new OracleConnection(oradb);
            try
               // using (conn = new OracleConnection(oradb))
                setupAdapter = new OracleDataAdapter("select * from ou_setup", conn);
                    OracleCommandBuilder builder = new OracleCommandBuilder(setupAdapter);
                    projDataset = new DataSet("Concordia");
                    setupTable = new DataTable("Setup");
                    projDataset.Tables.Add(setupTable);
                    setupAdapter.Fill(projDataset,"Setup");
                    //bind the gataGridView
                    this.setupGrid.DataSource = projDataset.Tables["Setup"];
                    this.setupBindingSource.DataSource = projDataset.Tables["Setup"];
                    this.setupNavigator.BindingSource = this.setupBindingSource;
            catch (Exception ex)
                string error = ex.Message;
                MessageBox.Show(error);
        private void saveSetupBtn_Click(object sender, EventArgs e)
           // only after sabe button clicked for the second time the changes are commited into the database
            this.setupAdapter.Update(projDataset.Tables["Setup"]);
            MessageBox.Show("saved");

How are you reading in the object initially? The problem is likely that you are modifying an object from the session cache. When you then read in the object from the uow, it uses the object in the session cache as the back up. So there will not appear to be any changes to persist to the database.
You will need to make a copy of the object for modification, or use the copy from the unitofwork to make the changes instead of working directly on the object in the session. Disabling the cache means there is no copy in the session cache to use as a back up, so the uow read has to build an object from the database.
Best Regards,
Chris

Similar Messages

  • TopLink cached object changed are not commited to the database

    Hello,
    I'm using TopLink 10 and I have a writing issue with a use case:
    1. I read an obect using TopLink that is in the IdentityMap
    2. Using JSF this object is edited throught a web form.
    3. I give the modified object to the data layer and try to modify inside a unit of work:
    UnitOfWork uow = session.acquireUnitOfWork();
    //laspEtapeDef comes from JSF and has been modfied previously
    LaspEtapeDef laspEtapeDefClone = uow.readObject( laspEtapeDef );
    //I update the clone field
    laspEtapeDefClone.setDescription(laspEtapeDef.getDescription());
    uow.commit();4. I use again the same object to display it once modified.
    The object is modified in the cache but the modified fields are never commited to the database. This code works only if I disable the cache.
    So, I've modified my JSF form to send the fields instead of modifying directly the object.
    My question: Is there a way to commit changes mades in an cached object?
    I've found the following section in the documentation, that explain the problem but doesn't gives the solution:
    http://docs.oracle.com/cd/E14571_01/web.1111/b32441/uowadv.htm#CACGDJJH
    Any idea?

    How are you reading in the object initially? The problem is likely that you are modifying an object from the session cache. When you then read in the object from the uow, it uses the object in the session cache as the back up. So there will not appear to be any changes to persist to the database.
    You will need to make a copy of the object for modification, or use the copy from the unitofwork to make the changes instead of working directly on the object in the session. Disabling the cache means there is no copy in the session cache to use as a back up, so the uow read has to build an object from the database.
    Best Regards,
    Chris

  • Getting only the rows committed in the database

    Hi,
    I have one strange requirement in my application.
    I need to fetch the rows from a particular table in the database which are committed.
    I mean there are other view objects for that table and those view objects are manipulating the data in that table and doing postChanges(). But I need a way (may be using a view object or any other technique) for getting the rows which are COMMITTED in the database and not just posted using postChanges().
    Please advice how can I achieve this.
    Thanks

    Hi,
    I have one strange requirement in my application.
    I need to fetch the rows from a particular table in the database which are committed.
    I mean there are other view objects for that table and those view objects are manipulating the data in that table and doing postChanges(). But I need a way (may be using a view object or any other technique) for getting the rows which are COMMITTED in the database and not just posted using postChanges().
    Please advice how can I achieve this.
    Thanks

  • Why is my  CLEAR_BLOCK(no_validate) not committing to the database?

    What I need is when the alert button 1 is selected fo to the detail block(ADM) and just delete everything for the current master id. When I click on the button it deletes for a split second and all the data comes back.Quite confused..
    IF Id_Null(al_id) THEN
    Message('Alert does not exist');
    RAISE Form_Trigger_Failure;
    ELSE
    al_button := Show_Alert(al_id);
    IF al_button = ALERT_BUTTON1 THEN
         :global.cl_blk := 'Y';
         go_block('ADM');
         CLEAR_BLOCK(no_validate);
         synchronize;
         go_item('adm.dci_name');
         execute_query;
    else
              :global.cl_blk := 'N';
    GO_ITEM('AM.MAPPING_LEVEL');
    END IF;
    END IF;

    Why is my CLEAR_BLOCK(no_validate) not committing to the database?Better read the Clear_Block on-line help. I think you are mistaking the No_Validate parameter with the Do_Commit parameter.
    The No_Validate parameter "*+Form Builder flushes the current block without validating the changes, committing the changes, or prompting the end user.+*"
    With No_Validate, your changes are discarded, and NOT committed.

  • Can the case be changed while uploading the data or after uploading ????

    hi all ,
    can u pls help me ???  can the case of the data in a itab be changed while running the program? the data is uploaded to an internal table and then based on loop at that itab the conditions will evaluate to give the result.... but the problem is like wen the data is given in small letters the worste(last)  condition is executing even the data satisfies the condtion which is not supposed to happen. this is due to case sensitive problem ...can u pls help me ....can the case be changed while uploading the data r after uploading ????

    this is the itab declaration ..
    data: begin of it_input occurs 0 ,
           tra          like tstc-tcode,
         end of it_input.
    and then from the uploaded data the prog should check wheather it is having any userexits or not ...
    here comes the code...
    sort it_input by tra.
    delete adjacent duplicates from it_input  .
    loop at it_input.
               it_itab-sno = sy-tabix.
      select single * from tstc where tcode eq it_input-tra.
    if sy-subrc eq 0.
        select single devclass from tadir into v_devclass
                 where pgmid = 'R3TR'
                        and object = 'PROG'
                        and obj_name = tstc-pgmna.
             if sy-subrc ne 0.
             select single * from trdir where name = tstc-pgmna.
             if trdir-subc eq 'F'.
                select single * from tfdir where pname = tstc-pgmna.
                select single * from enlfdir where funcname =
                tfdir-funcname.
                select single * from tadir where pgmid = 'R3TR'
                                   and object = 'FUGR'
                                   and obj_name eq enlfdir-area.
             move : tadir-devclass to v_devclass.
              endif.
           endif.
           select * from tadir into table jtab
                         where pgmid = 'R3TR'
                           and object = 'SMOD'
                           and devclass = v_devclass.
           if sy-subrc = 0.
            select single * from tstct where sprsl eq sy-langu and
                                            tcode eq it_input-tra.
                      if not jtab[] is initial.
               loop at jtab.
                    select single modtext from modsapt  into str
                         where sprsl = sy-langu and
                                name = jtab-obj_name.
                    it_itab-tra        = it_input-tra.
                    it_itab-i_obj_name = jtab-obj_name.
                    it_itab-i_modtext = str.
                    append it_itab.
                    str = ''.
               endloop.
              endif.
            else.
                    it_itab-tra        = it_input-tra .
                    it_itab-i_obj_name = ' '.
                    it_itab-i_modtext = 'No user Exit exists'.
                     append it_itab.
            endif.
          else.
                    it_itab-tra        = it_input-tra .
                    it_itab-i_obj_name = ' '.
                    it_itab-i_modtext = 'Transaction Code Does Not Exist'.
                     append it_itab.
          endif.
    endloop.

  • Hello, I have a iPod touch 4g,last time when I paired with my friends iPhone it showed his iPhone's name along with devices connected earlier in the bluetooth list after I updated my software to ios 5.1 the names of friends devices appear as D1:FG:12:13..

    Hello,
    I have a iPod touch 4g,last time when I paired with my friends iPhone it showed his iPhone's name along with devices connected earlier in the bluetooth list after I updated my software to ios 5.1 the names of friends devices appear as D1:FG:12:13:AK something like that and all the other previously connected devices appear in this same form in the bluetooth list how do I fix this back and it is confusing to connect to a device with no name but some unknown Bluetooth address so how do I find the device name back????
    SO PLEAZZZZZ HELP!!!!!

    An iPod can only pair with an iPhone for internet sharing provided that the iPhone has the subscribed to the tethering plan. The BT profiles do not permit file tansfer between IDevices by BT. The only BT pairsin is by app and those ar for peer-to-peer gaming.

  • Updated my iPhone 5 to ios7, in the App store after installing updates I now have a never ending list of the Apps I've updated.  How do I get rid of the list after they've been updated?  In the previous version I did not have an annoying permanent list.

    Updated my iPhone 5 to ios7, in the App store after installing updates I now have a never ending list of the Apps I've updated.  How do I get rid of the list after they've been updated?  In the previous version I did not have an annoying permanent list.

    iOS 7 allows you to have your apps update automatically. Therefore, the list of what has been updated stays so that you can see what was updated, when and what the release notes say. It has been suggested that they list has a limit, much like Recents. Currently, there is no way for the user to delete the entries manually. Just try not to look at them.

  • I am having problems with my burst mode on my iphone 6 plus it is slower than  the facetime camera after i updated to ios 8.3 apple please fix this issue i am fed up with all your mistakes

    i am having problems with my burst mode on my iphone 6 plus it is slower than  the facetime camera after i updated to ios 8.3 apple please fix this issue i am fed up with all your mistakes

    Gerald
    If you had taken time to read the Terms of Use you agreed on joining this Community today you would have realised that Apple is not here
    neither reading nor responding on this User Community
    http://www.apple.com/feedback/

  • Can i un-install the old versions after 2014 update

    I now have 3 versions of every application installed on my desktop,
    CC
    64bit
    (2014)
    can i un-install the old versions after 2014 update?
    aldo I have a 64bit platform is the new (2014) 64bit or do I have to install that version????!!??

    We don't overwrite your apps so you can keep previous workflows.
    Delete apps you don't want when you are ready.
    Please refer to:
    https://helpx.adobe.com/creative-cloud/faq.html#deskApps
    http://blogs.adobe.com/jkost/2014/06/installing-the-2014-release-of-creative-cloud.htm
    Regards
    Rajshree

  • TS1424 I can't open the iTune store after I updated my iphone to iOS 7.

    Hi there, could someone help me here please - I can't open the iTune store after I updated my iphone 4 to iOS 7. The problem occurred about 5 days later after the upgrade. There are no error messages. As I tap on the icon it opens just for a fraction of a moment and then goes off and back to the main screen. Other apps are working just fine. I tried following the troubleshooting steps as suggested by apple support, but that didn't help unfortunately...
    Thank you

    Refer to this article:
    Can't connect to the iTunes Store
    http://support.apple.com/kb/TS1368

  • Trigger changes are not committing to the database

    I have 9iAS and 9i DB both on my laptop.
    I am having a problem in which a trigger run off a WHEN_BUTTON_PRESSED function is not committing the changes to the database. In the trigger I have:
    1 record insert into table A.
    1 record update to table B.
    1 record insert into table C.
    1 delete from table D.
    None of the data is related.
    I have tried various combinations of the below to get the changes to commit:
    POST;
    COMMIT_FORM;
    Exit_Form(NO_COMMIT, NO_ROLLBACK);
    MESSAGE('Got past COMMIT');
    COMMIT;
    CLEAR_FORM(NO_COMMIT);
    ENTER_QUERY;     
    I am getting varying amounts of "FRM: 40508 Oracle Error: Unable to INSERT record" statements. Even so, many times the form would act as if the changes had been properly applied. But when I did a separate DB verification, I would see that the changes are not being committed. Also, most of the time the changes would also be reflected in the calling form queries, but when I exit, all changes are rolled back no matter how many commit stmts are in the trigger.
    I have finally gotten the form to do what I want to do (the 4 steps noted above), but I had to add a FORMS_DDL('COMMIT'); stmt and I am still getting a FRM 40508, but at least the changes are appearing in the db.
    Any ideas on why so many troubles in getting the changes to commit??? I have spent a ton of hours trying "what ifs" to see what might work. Also, this trigger is the only real "code" in the forms.
    Kim

    Brett -
    You're probably right about the intention, but this is a place where people can come and share styles, ideas, and coding tricks, I don't understand why someone would say that. Additionally, I had a professor who was a complete momo that said that all the time (consequently, his lax attitude towards teaching crippled the IS program where I graduated and most likely will cause it to no longer be available). It's a personal peeve of mine, just to let you know where I was coming from.
    Secondly, the problem I'm having may have to do with what you said, however I can't be sure. To give a better description of my scenerio, I created a form that allows the user to load information about an employee by querying a SSN. Most of this information is for display only. Six fields are available to be updated and I wrote a DML UPDATE statement that I placed inside a WHEN-BUTTON-PRESSED trigger. However, these changes won't be written to the DB because Forms is attempting to write my entire datablock, instead of just following the specified DML statements. I'm at a loss as to why this would happen, but for simplicity's sake, I would listen to ideas of how to suppress this from happening so only my statements are used when updating the DB. If you can help, thank you, if not, then thank you for your time.
    Steve

  • Changing a Record to Read-Only after an event.

    I have a Developer application that needs to be modified. This
    application includes several fields as well as a comments
    field. I'd like to change all updatable fields (not to included
    the comments field) to READ-ONLY after a certain event. Then
    after a certain date, I'd like to make the comments field READ-
    ONLY.
    Do you have any suggestions?
    Regina Grimes
    919/874-3140
    null

    Dear Regina,
    Have you tried to set_block_property in pre-record trigger to update allowed/not allowed depending on the event. And in post-record update not allowed. These triggers must be on block level. Also on item level to the item 'Comment' define pre-item trigger where take a new decision whether you want to open the entire block or not, the same way as on block level triggers. But in post-item trigger always make the entire block read-only again.
    Regards
    Jan Kramle

  • Track any changes made to the database.

    HI All,
    I've been assigned the task, where I need to track down any changes made to that schema objects, pl/sql objects and. Now, is there any procedure or package which can make it possible.
    hare krishna
    Alok

    I actually want to track all the changes in one perticualr schema. tables,
    indxes , views and pl/sql objects.Okay, I'm going to presume that means you want to track DDL changes in the nominated schema.
    the proper way to do this is not to track DDL changes in the nominated schema. Instead you set up a source control repository external to the database and store all the DDL scripts (i.e. files) there. If anybody wants to make a change to an object they have to check out the relevant script(s) and make the changes there. Once they have completed their changes they check the script back in. All builds of live (i.e. UAT and Production) systems must be done using scripts from the SC repository.
    This may sound complicated and some people who have been used to a more cowboy approach will complain. But it is the only sensible way to manage change in a database. I have the scars to prove it. Listen to the voice of experience.
    Cheers, APC
    Blog : http://radiofreetooting.blogspot.com/

  • Closing the database connection after report in a server application

    I searched these forums and the internet for a definitive answer on asking the Crystal SDK for java to close the jdbc connection after it has generated a report.  We have been using the Crystal Report SDK to generate reports within our JEE application, built upon the Spring framework, for the past two years.  It works well, especially if you prepare views in the database for your reports.
    From what I can tell once you have used ReportClientDocument to create your report you all the close() method to release resources associated with report generation, but this does not close the jdbc database connection.
    Further research states that if you are using the CrystalReportViewer you can call the dispose method to close the database connection.  We are not using JSP nor this class, so that does us little good.
    Finally I found a post that one could call ((AdvancedReportDocument)reportClientDocument.getReportSource()).dispose().  This doesn't drop the connection either.
    Each report actually opens 3 connections according to SQL Server.  Each report will reuse the connections it has open, so for 50 reports, theoretically, we could have up to 150 connections.  We explained to our client those connections  remain inactive, however this is unacceptable to our client as they would like to minimize the number of connections left open to their database.
    If anyone can post any further information on this issue, it is much appreciated.

    Yes, another team member found the issue.  Quite embarrassing really I didn't see it.  I was looking for the answer within Crystal's libraries.  It had nothing to do with Crystal.
    The developer who wrote the helper code for using Crystal first opened a connection to the datasource for the live production database and read that connection information for the report. Next he set that connection information in the report template's PropertyBag, then ran the report. The developer however forgot to close the connection he used to look up the connection info, leaving a memory leak and using up all the connections.
    I'm glad you inquired.  I forgot to post the resolution here.

  • How to reduce the database size after deleting huge amount of rows?

    Hi,
    I have a large database. I removed almost half of the data/rows. Now i need to reduce the size of the database file as I need more disk space for the database file.
    What should I do in details please.
    Thanks.

    Hi,
    I have a large database. I removed almost half of the data/rows. Now i need to reduce the size of the database file as I need more disk space for the database file.
    What should I do in details please.
    Thanks.
    Deleting large data would have ultimately put ghost cleanup into action. You would not be able to free space using shrink operation untill it completes. So wait for time and then start shrinking. You should note that shrinking would cause fragmentation and
    you would have to rebuild indexes after shrinking is completed
    Please mark this reply as answer if it solved your issue or vote as helpful if it helped so that other forum members can benefit from it
    My Technet Wiki Article
    MVP

Maybe you are looking for

  • Problem with Full Screen Caller App on my Nokia 67...

    Hi, am having some trouble with the Full Screen Caller App, that I downloaded yesterday from the Ovi Store.... It seemed to work ok, but is inconsistent - when texts come through, some say who the text is from (& the image associated with that contac

  • "Back to My Mac is turned on, your VPN connection cannot be established"?

    Hi, I searched for this recurring notice that I am getting " Because Back to My Mac is turned on, your VPN connection cannot be established", and came up with this thread: http://discussions.info.apple.com/message.jspa?messageID=8436720 However, I am

  • HDCP ***** Apple!

    Be careful when you download HD content from Apple, you might not be able to watch it! Apparently my Apple Cinema Display is not up to it because it is not HDCP compliant, therefore even though it is capable of displaying HD content from everywhere e

  • Authorization check in CRM ISA

    Dear All, I need some small help. We have SAP CRM ISA MSA 5.0 SP8. We need to create some roles for the end users who access the system via the CRM Webshop. But we are not able to trace what authorization a user requires or lack. Like when I give a r

  • Photoshop CS6 crashing before it opens?

    I recently installed CS6 student/teacher version, but after installing, whenever I try to open it, it loads through to "initializing", and then crashes right away. I've tried using both the  64 bit and the regular versions, both have this problem. Ev