The following code continues to give me a "RUntime Exception: object should first be initialized (map)". The results of the query I perform are NULL (as there is no record that matches. I understood that the QueryResults Map would then have a NULL in it.
What am I doing wrong, I've looked at this 10 ways to Sunday?
What am I doing wrong, I've looked at this 10 ways to Sunday?
B4X:
Sub FindSalebyUPC(whatupc As String)
Dim sqlcmd As String
Dim QueryResults As Map
Log("Sales:FindSalebyUPC: Searching for " & whatupc)
sqlcmd = "select * from items_sold, sales where sales.id = sales_id AND upc ='" & whatupc &"'"
QueryResults = DBUtils.ExecuteMap(Main.SQL,sqlcmd,Null)
If QueryResults = Null Then
Msgbox("No sale found for that UPC", "E R R O R")
Else
lblSalesId.Text = QueryResults.Get("sales_id")
lblDtTm.Text = QueryResults.Get("date")
edtTender.Text = QueryResults.Get("amttender")
lblPaidby.Text = QueryResults.Get("paidby")
edtUpc.requestfocus()
End If
Return
End Sub