Android Question Problem with Connecting Android to MySQL Database

Status
Not open for further replies.

Shubhankar

Member
Licensed User
I refer to the Mysql tutorial

In the tutorial a two line custom type is used

If I want to get more than 2 responses form the server do I still use twolines as a custom type?
I tried using five lines but it doesnt work
Is there a generic type i can use for multiple return values
 

Shubhankar

Member
Licensed User
Line 38
Main.ExecuteRemoteQuery("SELECT id, course_name, course_desc, course_days, course_rating, course_prereq, course_outcomes, course_comments, course_grant FROM mobile WHERE id='" & tl.First & "'", COUNTRY_POPULATION)
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
are you sure tl.First does contains a number at this point of code?
Try to add a
B4X:
log(tl)
before the line Main.ExecuteRemoteQuery
 
Upvote 0

Shubhankar

Member
Licensed User
The error is not in this line.

It is in JobDone.

1. You should run your program in debug mode and post the error message from the logs.
2. You should post the relevant line from your code.
3. You should post the output of Log(m)

1.
LogCat connected to: B4A-Bridge: samsung GT-P5113
--------- beginning of /dev/log/system
--------- beginning of /dev/log/main
running waiting messages (21)
** Activity (main) Resume **
** Service (service1) Destroy **
** Service (service1) Create **
** Service (service1) Start **
Connected to B4A-Bridge (Wifi)
Installing file.
** Activity (main) Pause, UserClosed = false **
PackageAdded: package:anywheresoftware.b4a.samples.mysql
Copying updated assets files (8)
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
** Service (httputils2service) Create **
** Service (httputils2service) Start **
Response from server: [{"id":"1","course_name":"Basic Excel 2013","course_desc":"Learn basic to intermediate functions of Excel. Simple formulas and features of Microsoft Excel 2013","course_days":"2 Days.","course_rating":"4.68"},{"id":"2","course_name":"Advanced Excel 2013","course_desc":"Learn Pivot Tables, VLookup, Macros & Advanced Functions of Excel.","course_days":"2 Days.","course_rating":"4.87"},{"id":"3","course_name":"Introduction to SQL","course_desc":"Learn to create a SQL database, query a database table and select, insert, update & delete records.","course_days":"2 Days.","course_rating":"4.89"},{"id":"4","course_name":"Facebook Marketing for Business","course_desc":"Learn to use Facebook for marketing your business on your own.","course_days":"1 Day","course_rating":"4.79"}]
** Activity (main) Pause, UserClosed = false **
** Activity (openfolder) Create, isFirst = true **
[First=null, course_rating=null, Second=null
, course_comments=null, course_days=null, course_desc=null
, course_grant=null, course_outcomes=null, course_prereq=null
, IsInitialized=false]
** Activity (openfolder) Resume **
** Activity (openfolder) Pause, UserClosed = false **
** Activity (main) Resume **
Response from server: [{"id":"4","course_name":"Facebook Marketing for Business","course_desc":"Learn to use Facebook for marketing your business on your own.","course_days":"1 Day","course_rating":"4.79","course_prereq":"Must know basic PC skills, and must have a Facebook account.","course_outcomes":"Learn to use Facebook for business use. Understanding Posting, Events, Groups, Pages and make the best use of the most popular Social Media Marketing application.","course_comments":"","course_grant":"SDF, PIC & SkillsFuture"}]
Error occurred on line: 107 (Main)
java.lang.NumberFormatException: Invalid double: "null"
at java.lang.StringToReal.invalidReal(StringToReal.java:63)
at java.lang.StringToReal.parseDouble(StringToReal.java:269)
at java.lang.Double.parseDouble(Double.java:295)
at anywheresoftware.b4a.BA.ObjectToNumber(BA.java:612)
at anywheresoftware.b4a.samples.mysql.main._jobdone(main.java:647)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:708)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:337)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:247)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:134)
at anywheresoftware.b4a.BA$2.run(BA.java:328)
at android.os.Handler.handleCallback(Handler.java:605)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4514)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:790)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:557)
at dalvik.system.NativeStart.main(Native Method)
** Activity (main) Resume **


2.Main.ExecuteRemoteQuery("SELECT id, course_name, course_desc, course_days, course_rating, course_prereq, course_outcomes, course_comments, course_grant FROM mobile WHERE id='" & tl.First & "'", COUNTRY_POPULATION)
 
Upvote 0
Status
Not open for further replies.
Top