Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

JDBC 2.0(ResultSet - update and insert methods)

Status
Not open for further replies.

metgut

Technical User
Mar 2, 2002
7
0
0
US


I was wondering if anyone could help me out. I get errors when i try to use the updateRow() and InsertRow() methods.

public void add( ResultSet rs ){

try{
rs.moveToInsertRow();

rs.updateString(2, "insert");
rs.updateString(3, "insert");
rs.updateInt(4, 1112221111);


rs.insertRow();
rs.beforeFirst();

}
catch( SQLException sqlex ) {

}
}
public void update(ResultSet rs){
try{

rs.updateString("First_Name", fields.First_Name.getText());
rs.updateString("Last_Name", fields.Last_Name.getText());
rs.updateString("Phone_Number", fields.Phone_Number.getText());
rs.updateRow();
JOptionPane.showMessageDialog(null, "The record has been updated", "Record Updated", JOptionPane.INFORMATION_MESSAGE);

}
catch ( SQLException sqlex ) {
sqlex.printStackTrace();
output.append( sqlex.toString() );
}
}

I'm using MS Access for the database. The way the code is right now, when i click update, we charaters show up. Nothing close to what I typed in. The insert on the other hand doesn't do anything. This class has other code to allow me to navigate through the resultSet and delete records. So, I'm sure that the connection and stuff works.

It would be great if someone can help me out here!

thanks,
MetGut
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top