can anyone help me. i have this prob in inserting a new row in my database. i am using microsoft sql as my database, using northwind database (the sample database in mssql).
my code is :
con = DriverManager.getConnection("jdbcdbc:nwind"
stmt = con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,
ResultSet.CONCUR_UPDATABLE);
ResultSet uprs = stmt.executeQuery("SELECT * FROM employees"
uprs.moveToInsertRow();
uprs.updateInt("EmployeeID",20);
uprs.updateString("LastName","TestName"
uprs.updateString("FirstName","TestFirst"
uprs.insertRow();
uprs.beforeFirst();
while (uprs.next()) {
System.out.println(uprs.getString(1)+" "+uprs.getString(2)+" "+uprs.getString(3));
it always throws an ArrayIndexOutOfBounds exception when it executes the uprs.insertRow(); i cant seem to find what i am missing in my code. can anyone help?
thank you in advance
my code is :
con = DriverManager.getConnection("jdbcdbc:nwind"
stmt = con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,
ResultSet.CONCUR_UPDATABLE);
ResultSet uprs = stmt.executeQuery("SELECT * FROM employees"
uprs.moveToInsertRow();
uprs.updateInt("EmployeeID",20);
uprs.updateString("LastName","TestName"
uprs.updateString("FirstName","TestFirst"
uprs.insertRow();
uprs.beforeFirst();
while (uprs.next()) {
System.out.println(uprs.getString(1)+" "+uprs.getString(2)+" "+uprs.getString(3));
it always throws an ArrayIndexOutOfBounds exception when it executes the uprs.insertRow(); i cant seem to find what i am missing in my code. can anyone help?
thank you in advance