Results 1 to 8 of 8
- 04-18-2008, 12:10 PM #1
Member
- Join Date
- Apr 2008
- Posts
- 31
- Rep Power
- 0
How to fetch an arralist element (i need the code)
WE HAVE TO CALL THE "SEL1" element IN THE PUBLI STATIC VOID MAIN METHOD.
[ "SEL1" element is located in an array in the public List fetchTicketkey1() method ie
al.add(rs.getInt("sel1")]
public class Keno {
public List fetchTicketkey1() {
List al = new ArrayList();
try {
pstmt=con.prepareStatement("select * from draw );
rs=pstmt.executeQuery();
while(rs.next()) {
al.add(rs.getInt("sel1"));
al.add(rs.getInt("sel2"));
}
} catch(Exception e) {
} return al;
}
public static void main(String[] args) {
Keno ken = new Keno();
List al = (List) ken.fetchTicketkey1();
}}(i need the code)
- 04-18-2008, 12:35 PM #2
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
- 04-18-2008, 12:45 PM #3
Member
- Join Date
- Apr 2008
- Posts
- 31
- Rep Power
- 0
hi Eranga
Thks for u r reply
how can we call the sel1 variable
/* ie located in al.add(rs.getInt("sel1"))*/
in the public static void main method
system.out.println( " the value of sel1 is " + al.sel1) //this is showing error
i need the correct code
- 04-18-2008, 12:48 PM #4
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
You want to get the element name sel1 which is in the al List, right?
- 04-18-2008, 01:32 PM #5
Member
- Join Date
- Apr 2008
- Posts
- 31
- Rep Power
- 0
yes, i need that element in the
public static void main method
for example like this ::: system.out.println( " the value of sel1 is " + al.sel1) //this is showing error
- 04-18-2008, 02:29 PM #6
Member
- Join Date
- Apr 2008
- Posts
- 31
- Rep Power
- 0
Hi Eranga
Did u got the code
if any queries reply me
- 04-21-2008, 03:26 AM #7
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
- 04-21-2008, 03:28 AM #8
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
Similar Threads
-
How to use Idref Element and its advantages
By Java Tip in forum Java TipReplies: 0Last Post: 03-30-2008, 10:04 AM -
Max element in an Array
By mew in forum New To JavaReplies: 5Last Post: 12-03-2007, 05:26 PM -
How to use Idref Element and its advantages
By JavaBean in forum Java TipReplies: 0Last Post: 09-26-2007, 08:37 PM -
a no such element exception
By headlice1 in forum New To JavaReplies: 1Last Post: 08-07-2007, 05:36 PM


LinkBack URL
About LinkBacks
Reply With Quote


Bookmarks