Edit: I should have been more clear. I am using SQL Server: mssql-jdbc-6.2.2.jre8.jar
I have several cursors returning small datasets with lots of fields. Since I need to store the data (because there are, evidently, only forward only cursors) I plan to put it in a map. It would be nice if I could do that with a loop using crsr.GetXXXX(Index). The problem is I also need the field name for the Key.
So my question is is there any way to get the field Names as well as the values using the index. Or, perhaps, some better, more efficient way to move the data from a cursor into a reusable format without a whole lot of assignment statement?
i.e.
Something like this:
Instead of this:
Thanks in advance for any help, ideas.
I have several cursors returning small datasets with lots of fields. Since I need to store the data (because there are, evidently, only forward only cursors) I plan to put it in a map. It would be nice if I could do that with a loop using crsr.GetXXXX(Index). The problem is I also need the field name for the Key.
So my question is is there any way to get the field Names as well as the values using the index. Or, perhaps, some better, more efficient way to move the data from a cursor into a reusable format without a whole lot of assignment statement?
i.e.
Something like this:
B4X:
Dim X as Int
Do While Crsr.NextRow = True
Dim Lbl As TextArea, P As B4XView, LV As ListView, MachineData As Map
MachineData.Initialize
For X = 0 To Crsr.NumberOfFields
MachineData.Put(Crsr.GetFieldName(X), Crsr.GetXXX(X))
Next
.....
Instead of this:
B4X:
Do While Crsr.NextRow = True
Dim Lbl As TextArea, P As B4XView, LV As ListView, MachineData As Map
MachineData.Initialize
MachineData.Put("SchM_ID", Crsr.GetInt("SchM_ID"))
MachineData.Put("SchM_WCCode", Crsr.GetString("SchM_WCCode"))
MachineData.Put("SchM_Machine", Crsr.GetString("SchM_Machine"))
MachineData.Put("SchM_Notes", Crsr.GetString("SchM_Notes"))
MachineData.Put("SchM_HrsPerWk", Crsr.GetInt("SchM_HrsPerWk"))
MachineData.Put("SchM_Cell", Crsr.GetInt("SchM_Cell"))
MachineData.Put("SchM_EmpAssignDayShift", Crsr.GetString("SchM_EmpAssignDayShift"))
MachineData.Put("SchM_EmpAssignShift2", Crsr.GetString("SchM_EmpAssignShift2"))
MachineData.Put("SchM_EmpAssignShift3", Crsr.GetString("SchM_EmpAssignShift2"))
MachineData.Put("SchM_Group", Crsr.GetInt("SchM_Group"))
MachineData.Put("SchM_FacilityNum", Crsr.GetInt("SchM_FacilityNum"))
MachineData.Put("SchM_Location", Crsr.GetString("SchM_Location"))
.....
Thanks in advance for any help, ideas.
Last edited: