updates problem of db table
hi..
i have used the following query for the update of two table values...
colum name=1)pay_header 2)pay_detail..
if i update the chq_amt values of pay_header table..them it also changes the db_amt values of pay_detail table.. means both column values of two different tabel should be equal.
here vou_no is foreign key in the pay_detail table...
PreparedStatement pstatement = conn.prepareStatement(
"UPDATE pay_header SET chq_amt = ? WHERE pay_header.vou_no=? ");
PreparedStatement pstatement1 = conn.prepareStatement(
"UPDATE pay_detail SET pay_detail.db_amt = ? WHERE pay_detail.vou_no=? ");
pstatement.setFloat(1,Float.parseFloat(request.get Parameter("chq_amt")));
pstatement1.setFloat(1,Float.parseFloat(request.ge tParameter("chq_amt")));
pstatement.setString(2,request.getParameter("vou_n o"));
pstatement.setString(2,request.getParameter("vou_n o"));
int rowCount = pstatement.executeUpdate();
int rowCount1 = pstatement.executeUpdate();
conn.setAutoCommit(false);
conn.setAutoCommit(true);
its only update the one field either chq_amt or db_amt..
plzz help me
|