« Return to Thread: commitchange function not work properly

Re: commitchange function not work properly

by Frank_lu :: Rate this Message:

Reply to Author | View in Thread

Hi David,

This is very helpful. Thanks a lot!
By checking the SQL, I found where is the problem come from. Basically, I didn't select column 'ID' in  CachedRowSet. That's why NetBean give me following SQL statement.

INSERT INTO PRB_myPRB_detl4 (Component_Column1, Component_Column2, Component_Column3) VALUES (?, ?, ?)
SELECT Component_Column1, Component_Column2, Component_Column3 FROM PRB_myPRB_detl4 WHERE Component_Column1 = ? AND Component_Column2 = ? AND Component_Column3 = ?
  Paramm[1]=(java.lang.String,_)  Paramm[2]=(java.lang.String,_)  Paramm[3]=(java.lang.String,_)
Writer:  executing pre-update SELECT
   Writer: pre-update SELECT returned >1 row:  BAD

After adding ID in CachedRowSet, it works fine now.

Thanks again for the help!

Frank

 
HandyGeek wrote:
Try turning on PrintStatements, this way NetBeans will display the SQL associated with your call.  The easiest way to find PrintStatements is to click on the RowSet provider in the Navigator window, then scroll down in properties until you find PrintStatements.  /David

 -------------- Original message ----------------------
From: Frank_lu <baobaofloyd@hotmail.com>
>
> Hi All, I have some difficulties when I am doing update operation on database
> table.
>
> DB table looks like
>
> ID   Component1   Component1_Desc   Component2   Component2_Desc  Component3
> Component3_Desc
> 1    _                  NULL                                        NULL                                      
> NULL
> 2                        NULL                                        NULL                                      
> NULL
>
> Value of column 'Component1', 'Component2', 'Component3' for second record
> is '  ' (Space).
>
> In my table layout setting, I selected Component1, Component2, Component3.
> (Component Type: Text Field )
>
> I believe that I setup virture form properly because I can save updates on
> first record.
>
> However, any changes I made on second records disappear after I call
> commitchange()
> I suspect there is sth to do with the ' ' in column1, column2 and column3.
>
> There is no error message displayed.
>
> Please help me. Thanks in advance.
>
>
>
> -----------------------------------------------------------------------------
>
> public String btnSave_action() {
>        
>         try{
>            
>             prb_myprb_trackingDataProvider.commitChanges();
>             prb_myprb_trackingDataProvider.refresh();
>         }catch(Exception ex){
>             log("Error Description", ex);
>             error(ex.getMessage());
>         }
>        
>         return null;
>     }
> --
> View this message in context:
> http://www.nabble.com/commitchange-function-not-work-properly-tp19736660p1973666
> 0.html
> Sent from the Visual Web - Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@visualweb.netbeans.org
> For additional commands, e-mail: users-help@visualweb.netbeans.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@visualweb.netbeans.org
For additional commands, e-mail: users-help@visualweb.netbeans.org

 « Return to Thread: commitchange function not work properly