Hello,
I am trying to return a count of specified values utilizing the SelectSQL function. I have a MySQL server running in the Ubuntu terminal and wish to return query results using a Xojo console app. The sample code online lead me to the following code.
'Connect to MySQL Database
Var mDb As New MySQLCommunityServer
Var rowsFound As RowSet
mDb.Host = “ip address of host”
mDb.Port = 3306
mDb.DatabaseName = “database_Name”
mDb.UserName = “username”
mDb.Password = “password”
Try
mDb.Connect
Catch error As DatabaseException
MsgBox ("Connection failed. Error: " + error.Message)
End Try
Lotnum = args(1) //value pulled directly from the terminal
'battery voltage or board serial number doesn’t exist
Try
rowsFound = mDb.SelectSQL("SELECT * FROM ? WHERE ? OR ? IS NULL ", Lotnum, batt_v, brd_serial_number)
For Each row As DatabaseRow In rowsFound
ListBox1.AddRow(row.Column(“part_not_exist”).StringValue)
Next
rowsFound.Close
Catch error As DatabaseException
MsgBox("Error: " + error.Message)
End Try
The online documentation for ListBox doesn’t explain if it can be used within a console app. I don’t see it as a super option which can be added.
Can Listbox be used in a console app? If so, where can I find it to add?
If not, is there a better or more feasible way to store the results from my SQL query? I need to access them later on.