Android Question Cursor issue with GetString method not finding column

joneden

Active Member
Licensed User
Longtime User
Hi All,

I've come across a new issue, whether it is the newer version of B4A, the version of android etc I don't know.

When I hit the objCursor.GetString("SurveyTemplateID") line in the below code I get this error:
java.lang.IllegalArgumentException: column 'SurveyTemplateID' does not exist

This issue raised it's head the other day and I resolved using GetString2 and the index of the column. My code seems to be OK and used to work so I am somewhat confused as to why it's suddenly failing. Any thoughts? Plainly the column does exist and there is data present in the output so this is very weird.

Regards

Jon

B4X:
Dim objCursor As Cursor = Common.sqlObject.ExecQuery2("SELECT SurveyTemplateID FROM SUR_SurveyTemplates WHERE OriginalSurveyTemplateID = ?", Array As String(OriginalSurveyTemplateID))
If objCursor.RowCount>0 Then
        objCursor.Position = 0
        SurveyTemplateID = objCursor.GetString("SurveyTemplateID")
End If
 

DonManfred

Expert
Licensed User
Longtime User
is that a new release of database. the table and or field are possibly new.
And the app is using an OLD version of the db??
Otherwise: post you samplecode including db-file here so we can have a look...
 
Upvote 0

joneden

Active Member
Licensed User
Longtime User
No the database itself hasn't changed and as said the fields are accessible via the ordinal reference, its just the column name that doesn't get recognized for some reason.

I'll upload a ver of the db if I cant get any further.

Cheers

Jon
 
Upvote 0

joneden

Active Member
Licensed User
Longtime User
Yeah tried that one :(

It's def not an issue with the code that I wrote as it's affecting stuff that previously worked. What I need to do I think is to double check the android SDK vers and also reinstall B4A along with updating the libs. After that I can then have a better idea where the issue lies.
 
Upvote 0
Top