inserting record using resultSet
Michel Maria-Sube <[email protected]> Mon, 17 Dec 2007 14:05:41 -0800 (PST)
| Newsgroups | gmane.comp.db.mysql.java |
|---|---|
| Message-ID | <[email protected]> |
Hello,
I'd like to develop a routine to insert a record in a
mysql table, actually I'm using a piece of code like
(assuming recNum is the cursor position of the JTable
where to insert the new record):
public void insert( int recNum, ... ) {
String query = new String("select * from myTable");
ResultSet rs = null;
try {
rs =
(ResultSet)(Conn.createStatemet(java.sql.ResultSet.TYPE_SCROLL_SENSITIVE,
java.sql.ResultSet.CONCUR_UPDATABLE).executeQuery(query));
} catch( SQLException e ) {
.....
}
.....
try {
rsForValues.moveToInsertRow();
} catch ( SQLException e ) {
............
}
try {
rs.updateXXX( field, value );
.....
} catch ( SQLException e ) {
...............
}
try {
rs.insertRow();
} catch ( SQLException e ) {
...............
}
But this insert a row but AT THE END of the list; is
there any mean to insert the row at sollicited
position (i.e before record at position recNum)??
Thank you in advance for any suggestion
Michel
}
--
MySQL Java Mailing List
For list archives: http://lists.mysql.com/java
To unsubscribe: http://lists.mysql.com/[email protected]