Problem inserting data into field

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • makweatan
    New Member
    • Jun 2009
    • 11

    #1

    Problem inserting data into field

    hI GUYS...

    seems that I cant insert data into table.

    I got this error:

    DB2 SQL error: SQLCODE: -104, SQLSTATE: 42601, SQLERRMC: REASON;ECT = ?, STATUS = ?;,


    here's the codes.

    Code:
    <script language="javascript">
    //suzie added
    $(document).ready(function(){
    	$("#dialog").dialog({
    		"modal": true,
    		"autoOpen": false,
    		"buttons": {
    		"Hantar":function(){
    	var f = document.getElementById('xcForm');
    	f.action="xc18TolakAction.do";
    	f.submit();
    		},
    	"Cancel": function() {
    		$(this).dialog('close');
    				}
    			}
    		});
    });
    
    function performRemsTolak(ele)
    {
        $("#dialog").dialog('open');
    	
    }
    
    <html:button styleClass="button" property="sbmit1" onclick="javaScript:performRemsTolak(this)"><bean:message key="grq_XC18_TOLAK"/></html:button>
    <div id="dialog" title="Reason "> : <input type="text"
    name="xcForm" id="reason"				class="text ui-widget-content ui-corner-all" size="7" />
    
    //in DAO.java
    
    String status = xcbo.getStatus();
    String reason = xcbo.getReason();
    
    
    if ( status.equals(DCMSConstants.USERTODO_STATUS_SEDIA)
    				|| status.equals(DCMSConstants.USERTODO_STATUS_PREPARE))
    		{
    	update_field = new StringBuffer()
    	.append(" OFFICER_PREPARE = ?, ")
    	.append(" DATE_PREPARE = ?, ")
    	.append(" STATUS = ? ")
    	.append(" REASON = ?")
    		.toString();
    else if( status.equals(DCMSConstants.USERTODO_STATUS_TOLAK))
    		{
    			
    	update_field = new StringBuffer()
    	    .append(" OFFICER_REJECT = ?, ")
    	    .append(" DATE_REJECT = ?, ")
    	    .append(" STATUS = ? ")
    	    .append(" REASON = ? ")
    		.toString();
    		}
    
    PreparedStatement stmt = null;
    	    StringBuffer sql = new StringBuffer();
    	    sql.append(" UPDATE " + tableName + " SET ");
    	    sql.append(update_field);
    	    sql.append(" WHERE ");
    	    sql.append(" TAXPAYER_KEY = ?");
    	    sql.append(" AND FILE_NO = ?");
    	    sql.append(" AND TAXTYPE_KEY = ?");
    
    
    stmt = conn.prepareStatement(sql.toString());
    	    stmt.setString(1, session.getUserBo().getUser_id());
    	    stmt.setTimestamp(2, now());
    	    stmt.setString(3, status);
    	    stmt.setInt(4,taxpayer_key);
    	    stmt.setString(5, file_no);
    	    stmt.setInt(6, taxtype_key);
    	    stmt.setString(7, reason);
    	    stmt.executeUpdate();

    Thank u very much.
    Last edited by Niheel; Jun 10 '10, 07:02 AM. Reason: Added code tags. Please use code tags to display code.
  • gits
    Recognized Expert Moderator Expert
    • May 2007
    • 5390

    #2
    this doesn't seem to be a JavaScript issue ... the SQL-query fails so does the serverside script get the correct values during the submit?

    kind regards

    Comment

    • makweatan
      New Member
      • Jun 2009
      • 11

      #3
      Originally posted by gits
      this doesn't seem to be a JavaScript issue ... the SQL-query fails so does the serverside script get the correct values during the submit?

      kind regards
      Thanks Gits....that means I should change the query, right?

      Comment

      • gits
        Recognized Expert Moderator Expert
        • May 2007
        • 5390

        #4
        have a look here ... it seems that there is a syntax error in your query?

        Comment

        • makweatan
          New Member
          • Jun 2009
          • 11

          #5
          thanks again Gits..will try to figure out when I get back to office...

          Comment

          Working...