To Insert a row in a DB Programatically & reflect the inserted row after DB Transaction.
try{
DCBindingContainer dcb= (DCBindingContainer)BindingContext.getCurrent().getCurrentBindingsEntry();
DCIteratorBinding dit =dcb.findIteratorBinding("CityView1Iterator");
ViewObject vo = (ViewObject)dit.getViewObject();
CityViewRowImpl cvrt=(CityViewRowImpl)vo.createRow();
cvrt.setCity1("California1");
cvrt.setState("Arizona1");
vo.insertRow(cvrt);
cvrt.validate();
vo.getApplicationModule().getTransaction().commit();
dit.executeQuery();
}catch(Exception e){
System.out.println("error Occurs");
e.printStackTrace();
}
try{
DCBindingContainer dcb= (DCBindingContainer)BindingContext.getCurrent().getCurrentBindingsEntry();
DCIteratorBinding dit =dcb.findIteratorBinding("CityView1Iterator");
ViewObject vo = (ViewObject)dit.getViewObject();
CityViewRowImpl cvrt=(CityViewRowImpl)vo.createRow();
cvrt.setCity1("California1");
cvrt.setState("Arizona1");
vo.insertRow(cvrt);
cvrt.validate();
vo.getApplicationModule().getTransaction().commit();
dit.executeQuery();
}catch(Exception e){
System.out.println("error Occurs");
e.printStackTrace();
}
No comments:
Post a Comment