Save and delete question

How to find out if there are other related records in another table.
If there are other related record then delete is not allowed.
For eample, Order has many items in it. 2 tables -Order Table and OrderItem table - one to many relationship.
Then Can't delete a record in the order table if there are related record in the OrderItem table.
I have 3 text fields. Enter data in it and then press the save button.
It will save it to the database.
how to force people to enter the data.
That is, if they press save and if any of the 3 text fields is empty then
show a message box saying need to fill in all text fields.
How to find out if the text field is empty?
How to save to multiple tables.
That is, how to save the master table first then the detail tabes.
For example, there is a order table and a orderItem table.
When save button is clicked. must save to Order table first then to
orderItem table.
How to find out if the user is saving the data and that data already
exists in database. So this is wrong. Can't have duplicate data.
----------------------------------------------

For ur first question:
use the transction to delete.if u found any of the conditions u mention rollback.seee the Connection class in jdbc API.normally its AtuoCommint true.so before starting transction setAutoCommit fasle.
second question:
in the saveButton action performed first check the textField.getText().equals("") for all the 3 textfields.if the condtions doesnt met popup optionpane.showdialog();
if met just save it.
3 rd question answer:
this also same like first question.try to save in transaction.if anything happens wrong everything will be rollbacked.
4th question:
use unique in sql .u can set the 1 r more columns in table as unique key.
for all these to work ur database shud support transactions....

Similar Messages

  • Urgent : Insert , save and Delete in the alv grid

    Hi Experts,
    I am having a alv grid and displaying data by fetching from backend.
    i added a toolbar buttons  "Insert " "Save"  and "Delete".
    when i click on "Insert " button the first row of the table should be empty with input fields. i want to insert data and when i click on "save"  button it should update at backend.kindly let me know how to insert empty row at starting of alv grid and also how to save and delete records..
    thanks in advance.

    Hi Bharath,
    Go through this hope u can understand.
    SEL_MODE. Selection mode, determines how rows can be selected. Can have the following values:
    A Multiple columns, multiple rows with selection buttons.
    B Simple selection, listbox, Single row/column
    C Multiple rows without buttons
    D Multiple rows with buttons and select all ICON
    Setting and getting selected rows (Columns) and read line contents
    You can read which rows of the grid that has been selected, and dynamic select rows of the grid using methods get_selected_rows and set_selected_rows. There are similar methods for columns.
    Note that the grid table always has the rows in the same sequence as displayed in the grid, thus you can use the index of the selected row(s) to read the information in the rows from the table. In the examples below the grid table is named gi_sflight.
    Data declaration:
    DATA:
    Internal table for indexes of selected rows
    gi_index_rows TYPE lvc_t_row,
    Information about 1 row
    g_selected_row LIKE lvc_s_row.
    Example 1: Reading index of selected row(s) and using it to read the grid table
      CALL METHOD go_grid->get_selected_rows
        IMPORTING
          et_index_rows = gi_index_rows.
      DESCRIBE TABLE gi_index_rows LINES l_lines.
      IF l_lines = 0.
        CALL FUNCTION 'POPUP_TO_DISPLAY_TEXT'
             EXPORTING
                  textline1 = 'You must choose a valid line'.
        EXIT.
      ENDIF.
      LOOP AT gi_index_rows INTO g_selected_row.
         READ TABLE gi_sflight INDEX g_selected_row-index INTO g_wa_sflight.
        ENDIF.
      ENDLOOP.
    Example 2: Set selected row(s).
      DESCRIBE TABLE gi_index_rows LINES l_lines.
      IF l_lines > 0.
        CALL METHOD go_grid->set_selected_rows
            exporting
              it_index_rows = gi_index_rows.
      ENDIF.
    Reward points if helpful.
    Thanks
    Naveen khan

  • CJI3 - Save and delete layouts...

    Hi... I need to save a layout under cji3. I have two queries:
    i) How to save and set it to default?
    ii) How to delete it once I have saved it? Having done this, is it possible to have any of the existing ones as default...
    Thanks

    Hi,
    in the same way as in many other applications.
    If you have the layout on the screen tick the button "save layout" (or go to "settings / layout / save). Enter a layout name + description. If you flag the layout as "user-specific", it only appears for the user who created it, if you flag the layout as "default-setting" it is defaulted.
    To delete a layout go again to "Settings / layout / manage" mark the layout to be deleted and delete it. By double-clicking the field "default-setting" you can determine another layout as default layout.
    All these options can be restricted by authorization concept...
    Best regards, Christian

  • How to get and delete questionable mail without actually opening it first.

    I am new to Apple again, having bought my first Apple many years ago (an Apple 2C). Does anyone know if I can get mail and delete it without opening it first? If so, I am thinking it is somehow in Preferences but I cannot figure it out. I often get mail from unknown sources (left over from my PC days - ?able viruses on PC) that I don't wish to take the chance to open. In order to delete it, I have to open it first. Any thoughts?? Thanks in advance for your help.

    Actually, there is a risk in viewing certain messages, but only if you have enabled Preferences > Viewing > Display remote images in HTML messages — see How HTML Email Messages Relate to Unsolicited Commercial Email ("spam").
    As long as Display remote images in HTML messages is OFF and you don’t click on any hyperlink or image the message may contain, you can safely view any messages you receive in Mail.
    That said, there are at least three ways to select a message and delete it without displaying its contents:
    (1) You can hide the preview pane by dragging the separator bar between the message list and the preview pane to the bottom of the window, or by just double-clicking within the separator bar, so that the preview pane disappears and only the message list is visible. To make the preview pane visible again, drag the separator bar up from the bottom of the window, or just double-click on the separator bar again.
    (2) If you select the message with the mouse, the message is displayed in the preview pane when the mouse button is released, not when it’s pressed. This allows you to drag the message to the Trash or to any other mailbox without Mail trying to display its contents.
    (3) Ctrl-clicking on a message causes a contextual menu to appear, from which you can usually (but not always, don’t ask me why) choose Delete or Move To, before the contents of the message are displayed in the preview pane.

  • Camera - bugs to save and delete photo

    Hi,
    After to upgrade my iphone 3g to iOS4 my camera does'nt work ok.
    1-Sometimes don't save my photos.
    2-when I look my camera rool doesn't photos exist.
    3-when there is one photo, and I need to delete appear a message: "saving" and that message stay on screen forever...
    Anybody with tha same problems?
    Apple has a solution?
    Tks

    I have an iPhone 4 and I just noticed that some of my photos aren't saving to the camera roll. I took multiple photos in rapid succession and a bunch are not appearing in the camera roll. Also, one large video file I took is also not appearing...

  • Photo storage and delete questions

    Hello there,
    I have photoshop cs51 and bridge.  I also have a new version of lightroom (I tried but was unable to download and use the creative cloud versions so had to do separate).  My versions of PS and bridge will not open raw, so i'm using 90% LR and only bringing photos into PS when I need that little extra.  I'm fine doing it that way.  I'm having a huge issue with photo storage and have some questions I'm hoping someone can answer.  Obviosly I'm not very technical, so simple answers work best.
    I had LR for months before PS and bridge.  Bridge has imported many of my photos.  If I delete them from bridge, will they be deleted from my computer, or only bridge?  Would it be possible for me to delete the bridge program, as I don't use it?
    My one year old Mac is already full and running out of storage.  I've moved my LR catalogues over to a portable HD.  It's my understanding that it 'removes' those photos....but keeps a thumbnail in LR for me to see.  I can only access the photos when they portable HD is connected to my Mac.  However, there is still SO much space being taken up by my photo's.  I'm not sure why.  Should I remove the thumnails from LR?  Do they still take up  a lot of space?
    I have been unable to load new photo's due to this issue.  Any help is appreciated!  Thank you!

    Bridge does not, like Lightroom, import photos. If you delete an image in Bridge, you delete it from your computer. I don't think you can uninstall Bridge, it's probably part of the Photoshop install.
    You should move your photos to the external HD, not the LR catalogs. The catalogs don't take up much space, your photos do. (And, btw, there's no need to have several catalogs, one is usally enough.) But you can leave your catalogs on the external HD if you like.
    When you move you photos to the external HD, make sure to keep the original folder structure. If you have a parent folder containing all your photos, the move will be easier. LR will put a question mark on all your files and folder. If you have a parent folder, then right click it in LR, and direct LR to the new location on the external HD.

  • Archive and Delete question

    Hi,
    I have 65K messages with ITFACTION set to ARCH and REORG set to INI.  The retention period is set to 2 days and these messages were all from 10/15.  Can someone tell me why when I run the archive job, these messages are not actually archived.  The ITFACTION should now say DEL.
    Any help is greatly appreciated.
    Regards,
    Rick

    Have a look at the document to make sure that you have configured the Delete job process correctlyy : http://www.sdn.sap.com/irj/scn/index;jsessionid=%28J2EE3417800%29ID1481370650DB01350833030815759400End?rid=/library/uuid/402fae48-0601-0010-3088-85c46a236f50&overridelayout=true
    http://help.sap.com/saphelp_nw04/helpdata/en/41/b715045ffc11d5b3ea0050da403d6a/frameset.htm
    Pooja.

  • Save and Export Data format issue/question

    Hi all, I'm hoping someone can help me with what is probably a super-simple question. I have a group of people that will use some forms. They will all have Acrobat Pro so they can save and update the data in the forms.
    Here's my issue. I've tried binding both a sample XML as well as an XSD with the same results.
    1.) If I save the interactive PDF containing the data connection, users can type the information in the form, but fields that are "info only" and not bound to a particular node go away. The file does generate the correct XML.
    2.) If I delete the data connection (but keep the bindings), all the data stays in the form, but now my XML tags are intermixed with my fields and subforms and the xml looks pretty useless.
    So, here's my question, given that users will use Acro Pro 7, how can I ensure that all data stays in the form on save and writes out xml ignoring fields that are not bound to any nodes in the xml.
    Thanks for your help!
    l

    Grid Control records the Serve name in the Repository. So, you will have a problem with it.
    Search this forum for related threads. There are loads of information which may include workarounds on Grid control from one server to the other

  • With recent calls , is it possible to save certain calls without saving them to contacts and delete the ones i dont want?

    My question is ,
    with the recent calls is the a way to save certain calls without saving them as contacts, and delete the others that i dont need?    I am a truck driver and i  need only certain calls during the day and if i could delete only the ones that arent needed for the day and keep the others that would make the day run smoother.  Each is different and when the day is finished then i would delete the ones i needed for the day and start all over again.   Is this possible?

    I think you would have to reinstall the keys seeing that if you format the computer all the data is gone. Even though you backed up that data you never know what can happen when you try to reinstall certain apps. Not sure what method you can go by, you should run a diagnostics test to see how you computer is doing internally.
    Goodluck

  • I bought and downloaded iWork when i bought my macbook pro and i used to save my documents on words. then a few weeks ago, i downloaded a free trial of microsoft office but unregistered and deleted it a week after. now i can't save my documents on word.

    i bought and downloaded iWork when i bought my macbook pro and i used to save my documents on words. then a few weeks ago, i downloaded a free trial of microsoft office but unregistered and deleted it a week after. now i can't save my documents on word. It used to ask me if I want to save my documents on word, now it doesn't. And the W icon keeps on appearing on my dock. Can I return my computer to an earlier date? Please help me. Thanks

    No, I don't have a back-up of TIme Machine... to tell you the truth, I have this computer for a few years now and I still don't know how to work all of the apps that are here. Anything else I can do?

  • I forgot my ICloud Password, Security questions, and deleted my back up email. How do I retain my password back?

    I deleted my email before I forgot my iCloud password and security questions. How am I able to access my ICloud account again?

    By contacting Apple and proving to them that it is your account, if you can.

  • Basic behavior - compile vs. save, application freezes and other questions

    Hi all,
    I've just recently moved from MS SQL to Oracle and found Oracle SQL Developer the only more or less working application to access the database and write scripts. Still, there are some issues which are beyond me in this application. So what I'd need to know:
    1) When I open a package and edit it, what is the difference between hitting CTRL+S (save) and Compile? I just need to change the code, not run the damn script. Run and Debug I suppose would execute the whole package.
    2) When I save a package, why does the application freeze? I have no idea what it is doing, but when I kill it the code is not changed.
    3) When I connect to packages of a different user why cannot it export the ddl / source code of the whole package?
    4) When I am inactive for some time, is there some normal way to reconnect to the connection other than disconnect + connect, which closes all windows I have open on the connection?
    5) Why does drag + drop a table name to SQL worksheet sometimes offer me to create a script and sometimes ignores me completely?
    6) Is there any way to convince the popups with table/column names to work also with variables and/or to show also data types of columns? Incidentally, is there a way to make it work all the time and not just during favorable moon phases?
    Thank you ever so much for answering any but preferably all questions.

    1. None
    2. Might be a lock - check the Enterprise Manager
    3. What is connecting to packages? How are you trying that export?
    4. Go vote on http://htmldb.oracle.com/pls/otn/f?p=42626:39:1538555050886906::NO::P39_ID:10421 to add weight for a real reconnect option
    5. Script? You mean insert/update/select, right?
    6. You mean the completion insight? Note you can force it to show with CTRL-space. If that doesn't work you'll have to be more specific.
    Regards,
    K.

  • Hi my question is how can I sort and delete photo files which I have had backed up multiple times? Another way how can I get rid of from the duplicate?

    Hi my question is how can I sort and delete photo files which I have had backed up multiple times? Another way how can I get rid of from the duplicate?

    Provide the name of the program you are using so a Moderator may move this message to the correct program forum
    The Cloud is not a program, it is a delivery process... a program would be Photoshop or InDesign or Muse or ???

  • Is it possible to save an iPhone back up and access the files later if needed?  I have a string of text sms and iMessages that I would like to save and then delete them from my phone.  Is this possible?

    I have a string of text sms and iMessages that I would like to save and then delete them from my phone, but gain access to them later if I need them.  I prefer to have the string with the date/time stamp vs copying and pasting into a doc or text file.  Is this possible?

    Not unless you buy an app that accesses data from an iTunes backup.  Check in the app store.

  • I have just upgraded to ios7 but cant seem to close any apps to save battery, on the old system it was just a double click and deleting the icons along the bottom of the screen, how do i do it now?? any help?

    i have just upgraded to ios 7 but cant seem to close any apps to save battery life, on th eold system it was just a double click and  deleting the icons along the bottom of the screen, any ideas how to now?
    Help?

    Close inactive apps
    1. Double tap the home button to bring up the multi-tasking view
    2. Swipe up on the screenshot of the app you want to exit.
    3. The app will fly off the screen

Maybe you are looking for