Android Question SQL - can't see what I'm doing wrong

Arf

Well-Known Member
Licensed User
Longtime User
Hi,
I get a compilation error:
error: inconvertible types
_pp = (String[])(mostCurrent._dbutils._executememorytable(_ba,_sql,"SELECT * FROM Patients WHERE Patient_ID='"+_epatientid+"' ORDER BY Patient_ID DESC",(String[])(anywheresoftware.b4a.keywords.Common.Null),(int) (0)).getObject());
^
required: String[]
found: List<Object>

from this portion of code:
B4X:
Sub GetPatientData(ePatientID As String) As PatientStruct
    Dim retPat As PatientStruct
    Dim pp(11) As String = DBUtils.ExecuteMemoryTable(SQL,"SELECT * FROM Patients WHERE Patient_ID='"&ePatientID&"' ORDER BY Patient_ID DESC",Null,0)

Any idea why this is failing?
Thanks.
 

fixit30

Active Member
Licensed User
Longtime User
DBUtils.ExecuteMemoryTable returns a List of Arrays

So you could try

B4X:
Dim pp As List = DBUtils.ExecuteMemoryTable(SQL,"SELECT * FROM Patients WHERE Patient_ID='"&ePatientID&"' ORDER BY Patient_ID DESC",Null,0)

BTW, it is much easier to pass the parameter as an array, so the above code would become:

B4X:
Dim pp As List = DBUtils.ExecuteMemoryTable(SQL,"SELECT * FROM Patients WHERE Patient_ID = ? ORDER BY Patient_ID DESC", Array as String(ePatientID),0)
 
Last edited:
Upvote 0
Top