-
JDBC iterating over multiple records
Hi,
I am trying to read a record from the database...and I am hgetting the values
of the first record and I am displaying them on to screen, but if i want
to iterate over all the records and display records onebyone(i mean multiple
records)..how do I do it..pls let me know....I am sending you the code below..
satish
/**
* readTransaction method for reding the different transactions that relate
to a different accounts in the PaymentBean
*/
public long readTransaction()
{
try
{
this.db2Connect();
// using prepared statement object to retrieve the values from the database
at runtime using place holder columns.
st = con.createStatement();
// setting the runtime values for the prepared statement object.
// executuing the SQL select query.
rs = st.executeQuery(Select * from tblCUSTRANS);
// iterating over the retrieved resultset object to the get the
required values.
while(rs.next())
{
L_SID = rs.getString("SID");
L_AccountNo = rs.getString("AccountNo");
L_StatementNo = rs.getString("StatementNo");
L_StatementDate = rs.getDate("StatementDate");
L_CreditCardNo = rs.getString("CreditCardNo");
L_CreditCardType = rs.getString("CreditCardType");
L_CreditCardSeqNo = rs.getString("CreditCardSeqNo");
L_CardHolderName = rs.getString("CardHolderName");
L_APACSMessage = rs.getString("APACSMessage");
L_TransID = rs.getInt("TransID");
L_PaymentDateTime = rs.getTimestamp("PaymentDateTime");
L_PaymentAmount = rs.getLong("PaymentAmount");
}
}
catch(Exception e) { e.printStackTrace(); }
return 0 ;
}
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks