MS Access Update Error In Index Positon 0
I am attempting to update a MS Access table and it works fine except for index postion 0.When index 0 is updated it updates index postion 1 instead.For all other positions it works fine.
Plese find code sample hereunder:
stmtUpdateRecord = connection.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);
rsUpdateRecord = stmtUpdateRecord.executeQuery("SELECT * FROM Student");
//entity data object set to current primary key
student = getStudent(m_intPk);
boolean found =false;
while (rsUpdateRecord.next() && !found)
{
int intPk = rsUpdateRecord.getInt("StuPrimKey");
//current pk
if (m_intPk == 0)
{
//new resultset pk == current pk
if(intPk == m_intPk)
{
found =true;
result = 1;
}
}
//new resultset pk == resultset pk ordered by firstname. -1 required else updates out of synch
elseif(intPk == m_intPk -1)
{
found =true;
result = 1;
}
}
rsUpdateRecord.updateString("StudentKnum",student.getStuKnum());
rsUpdateRecord.updateString("FirstName",student.getFname());
rsUpdateRecord.updateString("LastName",student.getLname());
rsUpdateRecord.updateString("DOB",student.getDob());
rsUpdateRecord.updateString("MobileNum",student.getTel());
rsUpdateRecord.updateString("CollegeEmail",student.getCmail());
rsUpdateRecord.updateRow();
connection.commit();

