Public Sub getTilefromDB(tablename, tilename)
If tilesDBfound Then
s = "SELECT JPG FROM " & tablename & " WHERE tilename='" & tilename & "'"
tilesDBcommand.CommandText = s
tilesDBreader.Value = tilesDBcommand.ExecuteReader 'Fill reader
If tilesDBreader.IsDBNull(0) Then
Msgbox ("tileDB is NULL, i.e. no results returned")
Else
If tilesDBreader.ReadNextRow = False Then
Msgbox("ERROR08: No results returned from DB table: "& tablename & ". Missing tile.","Error",cMsgboxOK,cMsgboxAsterisk)
Else
Return tilesDBreader.GetImage(0) 'return tile
End If
End If
tilesDBreader.Close 'Close reader
End If
End Sub