try
Integer.parseInt((String)pollVotecount.elementAt(i))

> -----Original Message-----
> From: Lai, Kenny
> Sent: Thursday, February 28, 2002 11:33 AM
> To:   [EMAIL PROTECTED]
> Subject:      vector cast to int
>
> i'm trying to do an explicit cast from vector object to int..
>
> if you look at the below stripped out code, where tempTotal is defined,
> that
> (int) conversion doesnt work..
>
> ultimately i'm trying to perform a division computation w/ totalVotes.
> anyone have a solution???
>
> ----
> java.sql.ResultSet regularPoll = null;
> try {
>   regularPoll = db.execSQL(" select votecount from sometable where
> id=someid");
> } catch (SQLException e) {
>         System.err.println(e.toString());
> }
> Vector pollVotecount = new Vector();
> while(regularPoll.next()) {
>    pollVotecount.addElement(regularPoll.getString("votecount"));
> }
> int totalNum = 100;
> int tempTotal = (int) pollVotecount.elementAt(i);
> int tempNum = tempTotal / totalVotes);
>
> ==========================================================================
> =
> To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
> JSP-INTEREST".
> For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
> DIGEST".
> Some relevant FAQs on JSP/Servlets can be found at:
>
>  http://archives.java.sun.com/jsp-interest.html
>  http://java.sun.com/products/jsp/faq.html
>  http://www.esperanto.org.nz/jsp/jspfaq.jsp
>  http://www.jguru.com/faq/index.jsp
>  http://www.jspinsider.com

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://archives.java.sun.com/jsp-interest.html
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.jsp
 http://www.jguru.com/faq/index.jsp
 http://www.jspinsider.com

Reply via email to