How to edit/update values in database?

hello!
i can't get the right syntax for code in updating a profile. i have tried to browse some e-books but all of the examples there are direct. meaning they have direct values. my condition is this, i have to update the contents ( e.g., username, password, name, address, contact no, email ad) of a particular user that is currently logged in.
the names of the two tables where i save the values are: userprofile and useraccounts
this is the code that i am currently editing right now.
rs = statement.executeQuery("UPDATE userprofile SET name=  where username = """);thanks.
=)

rs = statement.executeQuery("UPDATE userprofile SET name= where username = """);You should use executeQuery for "selects" and executeUpdate() for DML operations like insert ,updates, delete as depicted in jgalacambra's example.
Also a PreparedStatement is pre-compiled so will perform faster than a Statement.
Take care to close objects for PreparedStatement, Connection in the finally block. Exception occurence in the middle of code may cause connection leaks ..so your finally block will ensure that these are mandatorily closed.
Do refer tutorials with ready to execute examples. It would give you insight how to code the right way else you might end up posting each problem on this forum.
-Rohit

Similar Messages

  • How to get updated value at run time in oracle forms

    How to get updated value form oracle database on a field in oracle forms 6.0 at run time if the same form is opened by multiple users and both have get the same maximum value if one commit the record then how other would get that maximum value with out exiting that form...

    This issue is fairly common and Forms handles the situation by displaying the error, "Record has been updated by another user. Requery to see changes." if a user tries to update a record that was updated by another user.
    If your data is in a base table block, you can check before you save by checking the value in the form against the database using the Get_Item_Property('<BLOCK.ITEM>',DATABASE_VALUE). You can compare the value returned by the built-in against the value in the field to see if they have changed. This could be a lot of work and a lot of network traffic if you are checking numerous items in your data block. Forms has a standard locking mechanism that will lock the queried record as soon as a user makes any changes. If another user queries and attempts to change the record locked by another user - they will receive a "Record Locked" message.
    Francois brings up a valid point. Perhaps you should review the link Francios provided as well as this one: How to ask questions the smart way
    It is always a good idea to review your thread before you post it and ask yourself, "Could I answer this question given the information I've provided and the way I've asked the question?"
    Hope this helps,
    Craig B-)
    If someone's response is helpful or correct, please mark it accordingly.

  • Updating values in database table through Transaction

    Hi,
    Actually We have one transaction named EWAWA01. In that when we display the values from the transaction, there is a netweight field. The transaction displaying netweight values, but that value is not updated in the database table named EWA_WA_WEIGHPROC. How can i update that netweight value in the table.

    data:v_v_EWA_WA_WEIGHPROC type  (v_EWA_WA_WEIGHPROC lenth) c.
    decleare the data in charter type.
    after pass the data charter type.
    v_EWA_WA_WEIGHPROC = EWA_WA_WEIGHPROC
    update db.

  • How to get updated values from the loops while they are running

    Hello,
            I am having difficulty solving a very basic problem, how to access the updated values from the 'FOR loop' while its running?  Basically, the VI  I am currently working on calls two sub VIs. Each sub VI has a for loop, and both VIs may or may not run for same number of iterations. My goal is to read the values at each terminal inside the loop of both sub VIs, in the Main VI. I tried to achieve it using Global Variables, but in main VI it displays only the last iteration value from both sub VIs. Could anyone please tell me whrere am I going wrong? Is there any other/better way to achieve this.
    I appreciate any input on this issue.  
    Kudos are (always) welcome for the good post. :-)
    Solved!
    Go to Solution.

    Dennis,
                In attached VI, I can see the values changing in the sub VI from the main VI with the numeric indicator whose reference is passed on to the sub VI. Now if I wanted to store or use those values how do I do that? I tried to chnge the indicator to control and read from it (in the attached VI) , but the the indicator updates only once. Tried to create a property node and read the Value from it and it didn't work either.
    Thanks in Advance!
    -Nilesh
    Kudos are (always) welcome for the good post. :-)
    Attachments:
    main-1.vi ‏8 KB
    sub-1.vi ‏9 KB

  • How to insert / Update value for PFAKT in BP Relationship

    Hi Friends / Experts,
    How to insert the value for PFAKT ( Function value ) in BP Relationship in BP tcode , in SAP CRM.
    I have tried it but it BAPI_BUPR_CONTP_CREATE. But I need it with BAPI_BUPR_RELATIONSHIP_CREATE Function Module.
    Please help me out.
    Any Enhancement points in BAPI_BUPR_RELATIONSHIP_CREATE or any user exists. Please let me know.
    Regards,
    KMF.

    you can also acheive this using MERGE( available in sql 2008 and above).
    also, you are referring to DTS. DTS is legacy solution now..are you using sql 2000,  you can use ssis, if you want and it available in sql 2005. as said, there are multiple ways you can do this.. it find the below one a easy solution, since your are
    talking about only one table.. 
    try this example..
    create table test1(sno int primary key,sname varchar(20),scity varchar(20))
    go
    create table test2(sno int primary key,sname varchar(20),scity varchar(20))
    go
    insert into test1
    values(1,'stan','atlanta'),(2,'william','newyork')
    go
    insert into test2
    values(1,'robin','orlando')
    go
    --set this in you sql job and let it run for every half an hour
    MERGE test2 t2
    USING test1 t1
    ON t2.sno = t1.sno
    WHEN MATCHED THEN
    UPDATE
    SET t2.sname = t1.sname,t2.scity=t1.scity
    WHEN NOT MATCHED by target THEN
    Insert(sno,sname,scity)
    values (sno,sname,scity);
    go
    --check this table and clean up
    select * from test2
    go
    drop table test1
    go
    drop table test2
    Hope it Helps!!

  • Update value in database(access-connectivity toolset )

    Hello,
    I am using the database connectivity toolset and I am trying to change values of an existing database.
    I used the "Update" command but i got an ERROR!!!.
    "Exception occured in Microsoft JET Database Engine, Syntax error in UPDATE statement..  in Conn Execute.vi->...."????
    What to do???
    Regard's
    Eyal.
    Attachments:
    update value.jpg ‏23 KB

    Hi
    The shearch statement (after Where) shud be anather field than the field you are trying to change.
    I am using defoult value on cursor type with sucsess.
    I hope this will help you
    Rune

  • How to edit TCURC values in BI

    Can someone tell me how to edit values in TCURC table?
    (I'm having issues importing it from R3 and I need a quick fix in mean time)
    Thanks

    Just a bit more explanation on what Ravi posted:
    You should go to Customizing transaction SPRO and select the following path:
    SAP NetWeaver   ->General Settings->Currencies->Check currency codes
    That way you can also access the relevant documentation.
    This leads you to the view V_CURC.
    In there you can take advantage of the cross system table viewer to compare with the settings in your R/3 system. To do so select from the menu:
    Utilities->Adjustment (in Change mode)
    Utilities->Comparison (in Display mode)
    Pick the RFC connection to connect to your R/3 system. Use the Filter icon to hide identical records. Select all (Edit->Select->...) and click on Adjust. Copy all and go back confirming the pop up with Yes. That way you can copy over values from R/3 to BW.
    *Note: This tool works on all views that exist in both systems and you can compare and copy data easily.
    Best,
    Ralf

  • How to get string value from database table using Visual Studio 2005?

    Hi,
    Im developing plugin in illustrator cs3 using visual studio 2005. I need to get the values eneterd in database. Im able to get the integer values. But while getting string values it is returning empty value.
    Im using the below code to get the values from database table
    bool Table::Get(char* FieldName,int& FieldValue)
        try
            _variant_t  vtValue;
            vtValue = m_Rec->Fields->GetItem(FieldName)->GetValue();
            FieldValue=vtValue.intVal;
        CATCHERRGET
        sprintf(m_ErrStr,"Success");
        return 1;
    Im using the below code to get the values.
    AIErr getProjects()
        char buf[5000];
        int i;   
        std::string  catName;
        ::CoInitialize(NULL);
        Database db;
        Table tbl;
        errno_t err;
        err = fopen(&file,"c:\\DBResult.txt","w");
        fprintf(file, "Before Connection Established\n");
        //MessageBox(NULL,CnnStr,"Connection String",0);
        if(!db.Open(g->username,g->password,CnnStr))
            db.GetErrorErrStr(ErrStr);
            fprintf(file,"Error: %s\n",ErrStr);
        fprintf(file, "After Connection Established\n");
    if(!db.Execute("select ProjectID,ProjectName from projectsample",tbl))
            db.GetErrorErrStr(ErrStr);
            fprintf(file,"Error: %s\n",ErrStr);
        int ProjectID;
        int UserID;
        int ProjectTitle;
        char ProjectName[ProjectNameSize];
        if(!tbl.ISEOF())
            tbl.MoveFirst();
        ProjectArrCnt=0;
        for(i=0;i<128;i++)
            buf[i]='\0';
            int j=0;
        while(!tbl.ISEOF())
            if(tbl.Get("ProjectID",ProjectID))
                fprintf(file,"Project ID: %d ",ProjectID);
                ProjectInfo[ProjectArrCnt].ProjectID = ProjectID;
                sprintf(buf,"%d",ProjectID);
                //MessageBox(NULL, buf,"f ID", 0);
                j++;
            else
                tbl.GetErrorErrStr(ErrStr);
                fprintf(file,"Error: %s\n",ErrStr);
                break;
            //if(tbl.Get("ProjectTitle",ProjectName))
            if(tbl.Get("ProjectName",ProjectName))
                MessageBox(NULL,"Inside","",0);
                fprintf(file,"ProjectTitle: %s\n",ProjectName);
                //catName=CategoryName;
                ProjectInfo[ProjectArrCnt].ProjectName=ProjectName;
                //sprintf(buf,"%s",ProjectName);
                MessageBox(NULL,(LPCSTR)ProjectName,"",0);
            else
                tbl.GetErrorErrStr(ErrStr);
                fprintf(file,"Error: %s\n",ErrStr);
                break;
            ProjectArrCnt++;
            //MessageBox(NULL, "While", "WIN API Test",0);
            tbl.MoveNext();
        //MessageBox(NULL, ProjectInfo[i].ProjectName.c_str(),"f Name", 0);
        ::CoUninitialize();
        //sprintf(buf,"%s",file);
        //MessageBox(NULL,buf,"File",0);
        fprintf(file, "Connection closed\n");
        fclose(file);
        for(i=0;i<ProjectArrCnt;i++)
            sprintf(buf,"%i",ProjectInfo[i].ProjectID);
            //MessageBox(NULL,buf,"Proj ID",0);
            //MessageBox(NULL,ProjectInfo[i].ProjectName.c_str(),"Project Name",0);
        return 0;
    In the above code im geeting project D which is an integer value. But not able to get the project name.
    Please some one guide me.

    As I said in the other thread, this really isn't the place to ask questions about a database API unrelated to the Illustrator SDK. You're far more like to find people familliar with your problem on a forum that is dedicated to answering those kinds of questions instead.

  • How to process option value to database, plz help me out

    hi guys,
    can any one help me out in passing the option value to database.
    i have a 4 options, when any option selected, that should be processed to the database
    <form name="createfrm">
    <select name="select">
    <option value="1">1</option>
    <option value="2">2</option>
    <option value="3">3</option>
    <option value="4">4</option>
    </select>
    plz., can any one help me out by giving me the javascript code

    here's the part of the code:
    In th javascript this is the one that populates the array gender[].
    gender1[] array is where i put the values from the database so it is part of the jsp code. You will store what you fetch in gender1[] array.
    Then you store it in another array in javascript using the follwing codes:
    var gender = new Array(
    <%
    out.println("\""+gender1[0]+"\"");
    for(int ip = 1; ip < 3; ip++) {out.println(", \"" + gender1[ip] + "\"");}
    %>
    Now for populating the values of the dropdown list You will use the following codes:
    function fillGenCivil(){
    for (var jj=0; jj<3; jj++){
                                       document.registration1.gender.length++;
                                       document.registration1.gender.options[counta].value = gender[counta];
                                       document.registration1.gender.options[counta].text = gender[counta];
                                       counta++;
    the in the html tags: the form code will be like this
    <select name="gender" class="txtMed" > </select>
    These codes will automatically populate data in your dropdown list

  • How can we update procedure in Database Directly

    Hi Experts
    how can we create a stored procedure in a database directly. for example I made a crystal report with a demo databse, then I want to run that report on production database. for that I have to create stored procedure manually. I want that When I run the report It automatically create stored procedure . or other simple way to create stored procedure
    Regards
    Gorge
    Edited by: Gorge Ance on May 13, 2009 8:09 AM

    Hi
    If your field match what you have in demo and production ,all you need to do is run that stored procedure pointing to correct database .So you probable have to change alter to create .
    When you go to sql server , you have a choice to run a query of stored procedure  against the particular dtabase while you use query analyser .
    In crystal report , you have to manually change the datasource and update store procedure.
    Your report will now point to production database and point to correct stored procedure .
    Hope this helps
    Bishal

  • How can I update the QuickLook database?

    About 10 days ago my dock in Leopard crashed and I could not find it without restarting. Now I see in the console at startup:
    Dock[150] [QL ERROR] Generator database update takes too long... we will use what we currently have
    Since I have updated the Info.plist on my .tex files to conform to public.plain-text I would like quicklook to take note of it, but nothing I do will force it to take effect. On the command line qlmanage -r shows "resetting all generators" but qlmanage -m ends with the statement "generators change detected: NO". Any help would be greatly appreciated. Thanks

    This is by no means a complete answer. I still get the error messages in the console. However, I now have a partial answer to my question. After I log in, I run Cocktail 4.0.1 for Leopard, Select System then Databases. Then Rebuild Launch Services database with Restore default file associations enabled. About three quarters of the way through executing /System/Library/ScriptingAdditions/StandardAdditions.osax/Contents/MacOS/uid the .tex files lose the icon when selected, show the label "TEX" and can now be viewed with a touch of the space bar. What a pleasure. To the poster who recommends staying with Tiger, I say I never want to give up the pleasure of having Quick Look a spacebar away for all my files.
    Unfortunately, when I logout, restart or shutdown, once again, none of the org.tug.tex files are registered as public.plain-text and only the icon appears. To regain Quick Look capability I have to Rebuild Launch Services database. It only takes a few minutes, but I would like to automate the process somehow at login, but I have no idea how to do this. I will probably stay logged in for long periods of time, hoping that an update in the future will resolve this.

  • How to edit the value in the email activity in process flow

    I have an email activity in my process flow.
    I want to change the value for the message body of the email activity. But it is not editable. While creation all the columns are in editable mode and after deploying and testing, i want to change the body of the email to be sent.
    How can i do it now? Please advice. This issue is in 6.0.4 release.
    Edited by: 910070 on Feb 17, 2012 12:48 AM

    got the solution after so much research !
    in 6.0.4, only way we can change the value for the message body or subject is to change the associate email procedure. which is something like edx_rpt_email.

  • Updating value in Database

    HiALl
    Is there any way to update user attribute in Database with the help of Java code?
    If yes, please suggest some way.
    I can do it with updateUser API but it is calling Xellerate Provisioning process that i don't want bcoz of some requirement.
    I want to use my own Java code to update User's First name in Database. Please suggest how can i do it?
    Every Help will be appreciated!

    HiALl
    Is there any way to update user attribute in Database with the help of Java code?
    If yes, please suggest some way.
    I can do it with updateUser API but it is calling Xellerate Provisioning process that i don't want bcoz of some requirement.
    I want to use my own Java code to update User's First name in Database. Please suggest how can i do it?
    Every Help will be appreciated!

  • After getting data in tableView, how to edit this data in database ?

    I got data in tableView with the following code.
    Now How to make changes in database with this tableView.
    Can any body help me?
    //tableView codes
    try{
    data = FXCollections.observableArrayList();
    String SQL = "SELECT * from accounts";
    //ResultSet
    ResultSet rs = db.con.createStatement().executeQuery(SQL);
    * TABLE COLUMN ADDED DYNAMICALLY *
    for(int i=0 ; i<rs.getMetaData().getColumnCount(); i++){
    //We are using non property style for making dynamic table
    final int j = i;
    acctCode.setCellValueFactory(new Callback<CellDataFeatures<ObservableList,String>,ObservableValue<String>>(){
    public ObservableValue<String> call(CellDataFeatures<ObservableList, String> param) {
    return new SimpleStringProperty(param.getValue().get(0).toString());
    acctName.setCellValueFactory(new Callback<CellDataFeatures<ObservableList,String>,ObservableValue<String>>(){
    public ObservableValue<String> call(CellDataFeatures<ObservableList, String> param) {
    return new SimpleStringProperty(param.getValue().get(1).toString());
    acctTypeId.setCellValueFactory(new Callback<CellDataFeatures<ObservableList,String>,ObservableValue<String>>(){
    public ObservableValue<String> call(CellDataFeatures<ObservableList, String> param) {
    return new SimpleStringProperty(param.getValue().get(2).toString());
    tableView.getColumns();
    * Data added to ObservableList *
    while(rs.next()){
    //Iterate Row
    ObservableList<String> row = FXCollections.observableArrayList();
    for(int i=1 ; i<=rs.getMetaData().getColumnCount(); i++){
    //Iterate Column
    row.add(rs.getString(i));
    data.add(row);
    //FINALLY ADDED TO TableView
    tableView.setItems(data);
    tableView.getItems();
    }catch(Exception e){
    e.printStackTrace();
    System.out.println("Error on Building Data");
    }

    Hi Anubhav,
    You could try this:
    <htmlb:tableViewColumn columnName = "ACTION"
                                           title      = "<center>Action</center>"
                                           edit       = "<%= gv_edit %>"
    declare the variable gv_edit in the layout and default it to 'FALSE'.
    when the event 'modify' is trigerred, set the variable gv_edit as TRUE.
    Regards,
    Madhumitha

  • How to insert column values into database as rows

    Hi,
    I have 8 columns and some not null columns. Based on not null columns I want to insert into table as rows. The 8 columns may contain values or no value. If the first column contains data, then I have to insert into one row. if the second column contains data I have to insert a row and in second column. respectively...So How can I insert column values into rows. Can I write 8 insert statements. (OR) is it possible to insert data from columns using where clause.
    Please help me out....
    Thanks in Advance

    Lines Table:
    line_id, orcl_bank_account_num, product_type, service_type, lease_type,
    funding_type, cpi, billing_frequency_unit_cd , annual_due_date ,
    pricing_start_date, pricing_end_date, install_date, contract_end_date ,
    prdct_replacement_cost_amt, cradle_replacement_amt, supranet_contract,
    issuance_fee, board_inactive_date, header_id, creation_date, last_modified_date,
    created_by_nam, modified_by_nam, activeinactive_flg, prdct_bill_amt_yr1,
    prdct_bill_amt_yr2, prdct_bill_amt_yr3, prdct_bill_amt_yr4, prdct_bill_amt_yr5,
    prdct_bill_amt_yr6, prdct_bill_amt_yr7, prdct_bill_amt_yr8, activation_fee_yr1,
    activation_fee_yr2, activation_fee_yr3, activation_fee_yr4, activation_fee_yr5,
    activation_fee_yr6, activation_fee_yr7, activation_fee_yr8,
    In this table the columns structure is :
    -- PRDCT_BILL_AMT_YR (1 to 8) NUMBER(14,4)
    -- ACTIVATION_FEE_YR (1 to 8) NUMBER(8,2)
    I have one more table:
    PRDCT_INS_AMT               NUMBER(14,4)
    ACTIVATION_FEE_AMT          NUMBER(14,4)
    I want to insert prdct_bill_amt_yr (1 to 8) columns data into PRDCT_INS_AMT column. similarly activation_fee (1 to 8) columns data.
    But the data should be inserted based product_type, service_type, lease_type columns values. (These 3 columns may contain upto 45 combinations).

Maybe you are looking for