04-25-2019 5:15 AM
Hi everyone, hope someone can help. I would like to run through the lines of a user table, once I have two values from a recordset. Let's say I have one record with Code=1 and U_MyValue=1 and another with Code=1 and U_MyValue=2. How can I fetch then every record from the user table in order to update it?
public IRecordset getRecordsetFromSQL( String sql ) {
IRecordset rs = null;
try {
rs = SBOCOMUtil.newRecordset(getICompany());
rs.doQuery(sql);
} catch ( SBOCOMException e ) {
e.printStackTrace();
}
return rs;
}
public void updateUserTable() {
try {
String sql = "SELECT Code, [U_MyValue] FROM [@MYTABLE]";
IRecordset rs = getRecordsetFromSQL(sql);
IUserTables iUserTables = iCompany.getUserTables();
IUserTable iUserTable = iUserTables.item("MYTABLE");
rs.moveFirst();
while ( !rs.isEoF() ) {
String key= rs.getFields().item("Code").getValue().toString();
String myValue= rs.getFields().item("U_MyValue").getValue().toString();
// HERE I DON'T KNOW HOW TO FETCH EVERY RECORD IN ORDER TO UPDATE IT
iUserTable.update();
rs.moveNext();
}
} catch ( Exception ex ) {
System.out.println(iCompany.getLastError().getErrorMessage());
}
}
Thanks in advance.