Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

String to decimal?  RSS feed

 
smitha verghese
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
I am using Access database and i retrieve the contents which is in "string" from the Excel sheet using ExcelApi and put into the database Production with field "decimal" type !
like this
'"+Double.valueOf(rs.getString("LINE_COUNT")).doubleValue()+"','"+Double.valueOf(rs.getString("QUALITY")).doubleValue()+"'
But i get an error
java.lang.NullPointerException
at java.lang.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:9
90)
at java.lang.Double.valueOf(Double.java:172)
at _0002fLineCount_0002ejspLineCount_jsp_100._jspService(_0002fLineCount
_0002ejspLineCount_jsp_100.java:194)
 
Amol Desai
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
One of the getString() is returning null.
Better way would be to create a StringBuffer and append each rs.getString() to it.
You could then find which method returns null.
-Amol
 
Ilja Preuss
author
Sheriff
Posts: 14112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why don't you just do
'"+rs.getString("LINE_COUNT")+"','"+rs.getString("QUALITY")+"'
 
David Weitzman
Ranch Hand
Posts: 1365
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Since this isn't a performance question, I'm moving it to...um...Java in General (intermediate).
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!