How to create two String from ResultSet to arraylist?
Hi,
Here is my question:
String sql ="select colA, colB from tblA";
String str1 =null;
String str2 =null;
ArrayList al =null;
Statement stmt = conn.createStatement();
ResultSet rs = stmt.executeQuery(sql);
while(rs.next()){
str1 = rs.getString("colA");
str2 = rs.getString("colB");
}
May i know how can i set the str1 and str2 in the ArrayList al?
Thanks.
[705 byte] By [
tmj3638a] at [2007-11-26 15:35:52]

> Hi,
>
> Here is my question:
> > String sql = "select colA, colB from tblA";
> String str1 = null;
> String str2 = null;
>
> ArrayList al = null;
>
> Statement stmt = conn.createStatement();
>
> ResultSet rs = stmt.executeQuery(sql);
>
> while(rs.next()){
>str1 = rs.getString("colA");
> str2 = rs.getString("colB");
>
>
>
> May i know how can i set the str1 and str2 in the
> ArrayList al?
>
> Thanks.
is this what you're looking for?
al = new ArrayList();
al.add(str1);
al.add(str2);