Android Question RDC NumberFormatException on DATETIME

mmieher

Active Member
Licensed User
Longtime User
After doing a jRDC query to mySql with a record that contains a DATETIME column, I get an error

main_reqmanager_result (java line: 759)
java.lang.NumberFormatException: For input string: "null"
at java.lang.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:1306)
at java.lang.Double.parseDouble(Double.java:547)
at anywheresoftware.b4a.BA.ObjectToNumber(BA.java:646)
at com.ctt.my420menu.main._reqmanager_result(main.java:759)
at com.ctt.my420menu.main$ResumableSub_GetRDCRecord.resume(main.java:620)
at anywheresoftware.b4a.BA.checkAndRunWaitForEvent(BA.java:240)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:180)
at anywheresoftware.b4a.keywords.Common$11.run(Common.java:1151)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6823)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1557)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1445)
java.lang.NumberFormatException: For input string: "null"

if my code uses :
LastPublish = records(result.Columns.Get("LastPublish"))

but no error if i use:
LastPublish = records(3)

LastPublish is a string.

config.properties statement:
sql.SelectCustomer=SELECT custname, logofile, custapppwd, CAST(LastPublish AS CHAR) FROM customers WHERE custid = ?

Any ideas?

Marc
 

OliverA

Expert
Licensed User
Longtime User
If result.Columns.Get("LastPublish") does not exist, a Null is returned. This may be your issue. Try to log what the column name is at position 3 with Log(result.Columns.GetKeyAt(3)). It may not be what you expect.
 
Upvote 0

mmieher

Active Member
Licensed User
Longtime User
Thanks, Oliver. I am logging result:


Tag: null, Columns: 4, Rows: 1
custname logofile custapppwd CAST(LastPublish AS CHAR)
Melt Weed, LLC MeltWeed.jpg 123456 2017-11-15 07:13:34

Column name is defintely "LastPublish"

Marc
 
Upvote 0

OliverA

Expert
Licensed User
Longtime User
Upvote 0
Top