Java ResultSet.updateInt(int columnIndex, int x)

Syntax

ResultSet.updateInt(int columnIndex, int x) has the following syntax.

void updateInt(int columnIndex,  int x)  throws SQLException

Example

In the following code shows how to use ResultSet.updateInt(int columnIndex, int x) method.


/*  www .  j a  va  2 s.c o  m*/
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;

public class Main {
  public static void main(String args[]) throws Exception {
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    Connection con = DriverManager.getConnection("jdbc:odbc:Contacts");
    Statement stmt = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE);
    ResultSet rs = stmt.executeQuery("select * from employee");
    rs.moveToInsertRow();

    rs.updateInt(1, 150);
    rs.updateString("First_Name", "Nigel");
    rs.updateString("Last_Name", "Thornebury");

    rs.insertRow();
  }
}




















Home »
  Java Tutorial »
    java.sql »




DatabaseMetaData
ParameterMetaData
PreparedStatement
ResultSet
Timestamp