String index out of range: -1
2 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Akshay_B
Posted On:   Thursday, October 6, 2005 04:20 AM

Am gettin an error :

java.lang.StringIndexOutOfBoundsException: String index out of range: -1


While i am tryin to execute this query from my servlet :

rs3 = st3.executeQuery("SELECT DateDiff('d','"+dateFormat.format(rs2.getDate("last_login"))+"','"+dateFormat.format(date)+"') AS Expr1;");

Pease help!!

Re: String index out of range: -1

Posted By:   Anonymous  
Posted On:   Monday, November 14, 2005 03:25 AM

hi Akshay,

Do :

1: first retrieve the length of the field:
eg: field1.length().
2: Then use substring method to get the stringl

I think this should work.

- amin

Re: String index out of range: -1

Posted By:   Almagest_FUTT  
Posted On:   Thursday, October 6, 2005 05:08 AM

StackTrace ? Does the Exception really get thrown in the line you posted ?


Furthermore, remove the semicolon from the end of your query. You're not talking to a tty.

About | Sitemap | Contact