Greetings,
I’m having a little bit of an issue getting the SQLCommandMBS class to return a rowset. It keeps throwing a nil object exception “SQLDatabaseMBS not initialized” even though I’m still using the same instantiation and connection string code in other modules.
I set a breakpoint and poked around and near as I can tell the SQLConnectionMBS does get connected, the SQLCommandMBS params are getting passed through as a dictionary just fine and the execute function does seem to return an isResultSet flag set to true…so I’m not sure what I’m doing wrong.
Dev Platform: Windows Server 2016
Xojo: 2019 R3.1
Database: 10.3.20-MariaDB-0ubuntu0.19.04.1
MBS SQL Plugin: Latest.
Code:
[code]Var tmpDbConn As SQLConnectionMBS
Var tmpDbCmd As SQLCommandMBS
Try
tmpDbConn = New SQLConnectionMBS
tmpDbCmd = New SQLCommandMBS
tmpDbConn.SetFileOption tmpDbConn.kOptionLibraryMySQL, SpecialFolder.UserHome.Child(“libmariadb.dll”)
tmpDbConn.Connect(“xxxxxxxxxxxxxxxxxxxxxxx,3306@xxxxxxxxxxxxx”, “xxxxxxxxxxxxxxxx”, “xxxxxxxxxxxxxxx”, SQLConnectionMBS.kMySQLClient)
tmpDbCmd.Connection = tmpDbConn
tmpDbCmd.setCommandText(“SELECT id, last_name, first_name, middle_initial, member_id, city_township, state_province_region FROM members WHERE last_name LIKE :1 AND first_name LIKE :2 ORDER BY last_name ASC, first_name ASC LIMIT 25”)
tmpDbCmd.Param(1).setAsString("’%" + txt_last_name + “%’”)
tmpDbCmd.Param(2).setAsString("’%" + txt_first_name + “%’”)
tmpDbCmd.Execute
//tmpDbConn.Commit
Return tmpDbCmd.AsRowSet
Catch tmpSQLErr As SQLErrorExceptionMBS
Try
// On error rollback changes
If tmpDbConn <> Nil Then
tmpDbConn.rollback
End If
Catch x As SQLErrorExceptionMBS
// Ignore
End Try
// Show error message
MsgBox tmpSQLErr.message
End Try[/code]
Any help would be appreciated.
Thanks!
-Justin-
Link to screenshots
https://imgur.com/a/WXhszRU