F
francan00
I have a PreparedStatement with alot of values to insert into an
Oracle Database.
Anyway to shorten the setString lines in a loop or any other way to
shorten this??
//Database connection part here
//......
private PreparedStatement stmt;
public void houseMethod(BeanInfo theObject)
{
stmt = connection.prepareStatement("Insert into MainTable
(house, zipcode, city, county, phone, mortgage, tax, insurance, state,
land) values (?,?,?,?,?,?,?,?,?,?)");
stmt.setString(1, theObject.getHouse());
stmt.setString(2, theObject.getZipcode());
stmt.setString(3, theObject.getCity());
stmt.setString(4, theObject.getCounty());
stmt.setString(5, theObject.getPhone());
stmt.setString(6, theObject.getMortgage());
stmt.setString(7, theObject.getTax());
stmt.setString(8, theObject.getInsurance());
stmt.setString(9, theObject.getState());
stmt.setString(10, theObject.getLand());
stmt.executeUpdate();
}
Oracle Database.
Anyway to shorten the setString lines in a loop or any other way to
shorten this??
//Database connection part here
//......
private PreparedStatement stmt;
public void houseMethod(BeanInfo theObject)
{
stmt = connection.prepareStatement("Insert into MainTable
(house, zipcode, city, county, phone, mortgage, tax, insurance, state,
land) values (?,?,?,?,?,?,?,?,?,?)");
stmt.setString(1, theObject.getHouse());
stmt.setString(2, theObject.getZipcode());
stmt.setString(3, theObject.getCity());
stmt.setString(4, theObject.getCounty());
stmt.setString(5, theObject.getPhone());
stmt.setString(6, theObject.getMortgage());
stmt.setString(7, theObject.getTax());
stmt.setString(8, theObject.getInsurance());
stmt.setString(9, theObject.getState());
stmt.setString(10, theObject.getLand());
stmt.executeUpdate();
}