• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Junilu Lacar
  • Liutauras Vilda
Sheriffs:
  • Paul Clapham
  • Jeanne Boyarsky
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
Bartenders:
  • Jesse Duncan
  • Frits Walraven
  • Mikalai Zaikin

rs.updateRow() not working (..)

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
here is the code sample....

private void getActionPerformed(java.awt.event.ActionEvent evt) {
try{
query="select ptscno,ptbcrno,ptprno,trunc(to_date(ptprdt,'dd-mm-yyyy')),ptblamt,ptmisamt,ptmisamtcd,ptreconchg from payment where ptprno="+bcrc_prno.getText();
rs=stmt.executeQuery(query);
if(rs.next())
{
bcrc_scno.setText(rs.getString(1));
bcrc_prno.setText(rs.getString(3));
bcrc_bcrcno.setText(rs.getString(2));
bcrc_prdt.setText(rs.getDate(4).toString());
bcrc_billamt.setText(rs.getString(5));
bcrc_misamt.setText(rs.getString(6));
bcrc_misamtcd.setText(rs.getString(7));
bcrc_reconchg.setText(rs.getString(8));
dissable(true); //user defined function to dissable the text fileds
}
else
{
new opendialog(this,"ERROR MESSAGE ...").show();
bcrc_scno.setText("");
bcrc_bcrcno.setText("");
bcrc_prno.setText("");
bcrc_prdt.setText("");
bcrc_billamt.setText("");
bcrc_misamt.setText("");
bcrc_misamtcd.setText("");
bcrc_reconchg.setText("");
bcrc_prno.requestFocus();
dissable(false);
}

}catch(SQLException p){
System.err.print("SQLException :");
System.err.println(p.getMessage());
try{
con.close();
}catch(SQLException e)
{
System.err.print("SQLException :");
System.err.println(e.getMessage());
}
System.exit(2);
}
}


private void updateActionPerformed(java.awt.event.ActionEvent evt) {
try{

if(bcrc_scno.isEditable())
{
rs.updateString(1, bcrc_scno.getText());
rs.updateString(2, bcrc_bcrcno.getText());
rs.updateString(3, bcrc_prno.getText());
String dt=bcrc_prdt.getText();
java.sql.Date myDate = java.sql.Date.valueOf(dt);
rs.updateDate(4, myDate);
rs.updateString(5, bcrc_billamt.getText());

if(!bcrc_misamt.getText().equals(""))
rs.updateString(6,bcrc_misamt.getText());

if(!bcrc_misamtcd.getText().equals(""))
rs.updateString(7,bcrc_misamtcd.getText());

if(!bcrc_reconchg.getText().equals(""))
rs.updateString(8,bcrc_reconchg.getText());

rs.updateRow();

con.commit();
bcrc_scno.setText("");
bcrc_bcrcno.setText("");
bcrc_prno.setText("");
bcrc_prdt.setText("");
bcrc_billamt.setText("");
bcrc_misamt.setText("");
bcrc_misamtcd.setText("");
bcrc_reconchg.setText("");
bcrc_prno.requestFocus();
dissable(false);
}
else
{
new opendialog(this,"ERROR MESSAGE ...").show();
bcrc_scno.setText("");
bcrc_bcrcno.setText("");
bcrc_prno.setText("");
bcrc_prdt.setText("");
bcrc_billamt.setText("");
bcrc_misamt.setText("");
bcrc_misamtcd.setText("");
bcrc_reconchg.setText("");
bcrc_prno.requestFocus();
dissable(false);
}
}catch(SQLException p){
System.err.print("SQLException :");
System.err.println(p.getMessage());
try{
con.close();
}catch(SQLException e)
{
System.err.print("SQLException :");
System.err.println(e.getMessage());
}
System.exit(2);
}
}

the idea is to get the data and update it again

getActionPerformed is executed where get button is clicked that will get the data
and updateActionPerformed is executed when update button is clicked that will update the data

the problem is after i get the data from database and put it on some textfields and change some text and then click update button i am getting this error
SQLException RA-00927: missing equal sign

i am unable to figure out kindly help.
thanq in advance

stalin.
 
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm not sure that it would work at all: you result set field #4 is a computed value. I doubt a server would be able to parse back this computation:

select ptscno,ptbcrno,ptprno,trunc(to_date(ptprdt,'dd-mm-yyyy'))
 
girl power ... turns out to be about a hundred watts. But they seriuosly don't like being connected to the grid. Tiny ad:
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
    Bookmark Topic Watch Topic
  • New Topic