Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

array list?

Status
Not open for further replies.

sensory21

Programmer
Jan 27, 2004
79
GB
Hi all,

PreparedStatement prep = conn.prepareStatement("select company_name, contact_name, address, address2, city, pcode, country, phone, fax, email, website from customer");
ResultSet rs = prep.executeQuery();
while (rs.next()) {

//what I would like to do here is to set up a variable which includes several fields like
//contactMail = "address, address2, city, pcode, country";

//but keep some fields as they are
String company_name = rs.getString("company_name");

}

any ideas?
Thanks
 
i don't understant your query well, you wanna

Code:
String contactMail=
           rs.getString("address")+", "
           rs.getString("address2")+", "
           rs.getString("city")+", "
           rs.getString("pcode")+", "
           rs.getString("country");
or,
Code:
String[] contactMail = new String[5];
contactMail[0]=rs.getString("address");
contactMail[1]=rs.getString("address2");
contactMail[2]=rs.getString("city");
contactMail[3]=rs.getString("pcode");
contactMail[4]=rs.getString("country");
or none of them...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top