Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > MySQL
|
MySQL General discussion about the MySQL database.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the MySQL section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 17th, 2004, 07:36 AM
Authorized User
 
Join Date: Oct 2004
Posts: 34
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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







Similar Threads
Thread Thread Starter Forum Replies Last Post
repopulating CheckBoxList from db table problem enginev ASP.NET 2.0 Basics 0 April 1st, 2008 07:22 AM
update table from another db table timbal25 SQL Server 2005 3 January 19th, 2008 06:47 AM
Trigger & SP (Table Updates) Neal SQL Server 2000 6 April 25th, 2006 09:45 AM
Stored Procedure That Updates Table GailCG Classic ASP Professional 1 January 22nd, 2006 01:11 PM
Table / DB Structure mtangorre SQL Server 2000 1 June 27th, 2003 01:32 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.