Its simple U will have to have two prepareStatements for each table.
-----Original Message-----
From: Tom Kochanowicz <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED] <[EMAIL PROTECTED]>
Date: Wednesday, May 12, 1999 9:19 PM
Subject: Prepared Statement with two database tables.

In my servlet I used to have one table. For performance reasons
I broke the table into two tables. I can't get it to work now because
I'm not sure how to set up the prepared statement. Any Ideas or examples
would be appreciated. Here is an example of BEFORE and AFTER

BEFORE
registerStatement =
     dbConnection.prepareStatement("insert into Classifieds "
      + "(Name, Address, City, State, Zip, Email, Phone, PayMethod, CardNumber, CardMo, CardYr, StartDate, EndDate, AmtForDayMoYr, ClassifiedAd, WhatAdSays01, WhatAdSays02, WhatAdSays03, WhatAdSays04, WhatAdSays05, WhatAdSays06, WebSite, UniqueDateId)"
 + " values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");

AFTER (this doesn't work with two tables... can you tell me why?)
    // First table
 registerStatement =
                 dbConnection.prepareStatement(("insert into CustInfo "
      + "(UniqueDateId, Name, Address, City, State, Zip, PayMethod, CardNumber, CardMo, CardYr, StartDate, EndDate, AmtForDayMoYr)"
      + " values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)")
    // Second table
    + ("insert into AdInfo "
      + "(UniqueDateId, ClassifiedAd, WhatAdSays01, WhatAdSays02, WhatAdSays03, WhatAdSays04, WhatAdSays05, WhatAdSays06, Phone, Email, WebSite)"
      + " values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"));

Reply via email to