Statement stmt = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE); ResultSet rs = stmt.executeQuery("SELECT * FROM TABLE2"); rs.moveToInsertRow(); // moves cursor to the insert row rs.updateString(1, "AINSWORTH"); // updates the first column of the insert row to be AINSWORTH rs.updateInt(2,35); // updates the second column to be 35 rs.updateBoolean(3, true); // updates the third row to true rs.insertRow(); rs.moveToCurrentRow();
Statement stmt = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE); ResultSet rs = stmt.executeQuery("SELECT * FROM TABLE2"); rs.absolute(5); // moves the cursor to the fifth row of rs rs.updateString("NAME", "AINSWORTH"); // updates the NAME column of row 5 to be AINSWORTH rs.updateRow(); // updates the row in the data source
Tables_in_base gakuseki Field, Type, Null, Key, Default, Extra No, int(9), , PRI, 0, name, varchar(50), , , , math, int(3), YES, , null,
test1.txt 111111111 山田 10 555555555 佐藤 50 test2.txt 222222222 鈴木 20 333333333 山本 30 111111111 山田 10
No, name, math 111111111, 山田, 10 555555555, 佐藤, 50 No, name, math 111111111, 山田, 10 555555555, 佐藤, 50 222222222, 鈴木, 20 333333333, 山本, 30 No, name, math 111111111, 山田, 10 555555555, 佐藤, 50 222222222, 鈴木, 20 333333333, 山本, 30 444444444, 杉山, 40
No, name, math 111111111, 山田, 10 555555555, 佐藤, 50 222222222, 鈴木, 20 333333333, 山本, 30 444444444, 杉山, 40
No, name, math 111111111, 山田, 10 555555555, 佐藤, 50 444444444, 杉山, 40
No, name, math 111111111, 山田, 100 555555555, 佐藤, 50 999999999, 小川, 88 444444444, 杉山, 90
No, name, math 222222222, 鈴木, 20 333333333, 山本, 30 111111111, 山田, 10
No, name, math 222222222, 鈴木, null, 20 333333333, 山本, null, 30 111111111, 山田, null, 10
No, name, math 222222222, 鈴木, 20 333333333, 山本, 30 111111111, 山田, 10
菅沼ホーム | 本文目次 | 演習問題解答例 | 付録目次 | 索引 |