Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 04-15-2008, 09:15 AM
Member
 
Join Date: Apr 2008
Posts: 30
raj reddy can only hope to improve
...............................................
.............................................

Last edited by raj reddy : 04-24-2008 at 08:43 AM.
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 04-15-2008, 01:09 PM
Chris.Brown.SPE's Avatar
Member
 
Join Date: Apr 2008
Location: State College, PA
Posts: 50
Chris.Brown.SPE is on a distinguished road
Send a message via AIM to Chris.Brown.SPE
You have to return an ArrayList back to the main function and save it into a variable in the scope of the main function. Like so:

ArrayList x;
x = fetchTicketkey();

When i did this it said "cannot convert from list to arraylist so i changed your function to return an ArrayList instead of an Array. So the whole thing would look like this:

Code:
public ArrayList fetchTicketkey() { ArrayList li = new ArrayList(); String str=""; try { String query = "select tktkey from tktgame2day1 where start_draw=1"; System.out.println("IN THE METHOD "); con=databaseConnection.getConnection(); pstmt=con.prepareStatement("query"); rs=pstmt.executeQuery(); while(rs.next()) { li.add(rs.getString("area_name")); } rs.close(); con.close(); } catch(Exception e) { System.out.println(" ERROR in getting the values from tktgame2day1 Table "+e); } return li; } public static void main(String[] args) { ArrayList x; x = fetchTicketkey(); }
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Help In An Critical Query raj reddy Database 1 04-22-2008 03:24 AM
pls help me out its critical ...... how can we use an arralylist reference raj reddy Web Frameworks 0 04-15-2008 09:12 AM
Getting the Object Reference Name Deathmonger New To Java 2 03-12-2008 03:51 PM
reference to elements in array Igor New To Java 1 12-14-2007 12:56 PM
Object and reference katie New To Java 1 08-07-2007 12:00 AM


All times are GMT +3. The time now is 05:48 AM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org