Win a copy of The Business Blockchain this week in the Cloud forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Update problem. Please come in

 
fengzixuan zheng
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When I use this the following code to update the field "Name" in a SQL Server2000 table

rs.updateString("Name",this.tfName.getText());
rs.updateRow();
a Exception occoured :
java.sql.SQLException: [Microsoft][SQLServer JDBC Driver]Row update failed.
Date type of "Name" field is: nvarchar, Can I use updateString() method to update the value, if I cannot use this method, what should I do?
With regard.
Thank you!
 
fengzixuan zheng
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I downloaded a new SQL Server2000 JDBC driver, and this problem seems solvedb, but a new problem arise.
I have 5 buttons now: First, Previous, Next, Last, and Save.
I write the Save button code like this:
public void saveValue(){
try{
rs.updateString("Name",this.tfName.getText());
rs.updateRow();

getValue(); //getValue method show the value of field "Name" in a textField
}
catch (SQLException se){
se.printStackTrace();
}
}
public void getValue() {
try{
String strName=(String)rs.getString("Name");
this.tfName.setText(strName);
}
catch (Exception e) {
e.printStackTrace();
}
But when I change the Name field to "Gustav" and click save, it's OK, and I click "Previous" then "Next" , I found the "Name" value return to the former value "Steven". I close the application, and reopen, YES, it takes effect to change the value to "Gustav".
My question is how can I get the effect atonce without close and reopen the application

It's a little long, hope this question will not bother you.
Thanks very much.
[ June 03, 2002: Message edited by: fengzixuan zheng ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic