Android Question SQL ADD MARKER & GOOGLE MAPS

Croïd

Active Member
Licensed User
Longtime User
I have a small problem ! only 1 marker displayed on maps ! You know the way


B4X:
dbsql.Initialize(File.DirRootExternal,"Mybase.db",True)
dbcursor = dbsql.ExecQuery("SELECT * FROM Field")
'dbcursor = dbsql.ExecQuery("SELECT Field1, Field2, Field3, field4 FROM Field")
For i = 0 To dbcursor.RowCount -1
DoEvents
dbcursor.Position = i

Dim lat, lng As Double
Dim nms As String
Dim colr As Int

lat = dbcursor.GetDouble("Field1") ' Lat
lng = dbcursor.GetDouble("Field2")  'Lng
nms = dbcursor.GetString("Field3") ' Name
colr = dbcursor.GetInt("Field4")    'Color

Next
dbcursor.Close

'gmap.AddMarker2(dbsql.ExecQuerySingleResult("SELECT Field1 FROM Field"),dbsql.ExecQuerySingleResult("SELECT Field2 FROM Field"),dbsql.ExecQuerySingleResult("SELECT Field3 FROM Field"), dbsql.ExecQuerySingleResult("SELECT Field4 FROM Field"))

gmap.AddMarker2(lat,lng,nms,colr)  ' ???????????
 

susu

Well-Known Member
Licensed User
Longtime User
Try to move
gmap.AddMarker2(lat,lng,nms,colr)
before
Next
 
Upvote 0

susu

Well-Known Member
Licensed User
Longtime User
B4X:
dbsql.Initialize(File.DirRootExternal,"Mybase.db",True)
dbcursor = dbsql.ExecQuery("SELECT * FROM Field")
'dbcursor = dbsql.ExecQuery("SELECT Field1, Field2, Field3, field4 FROM Field")
For i = 0 To dbcursor.RowCount -1
dbcursor.Position = i

Dim lat, lng As Double
Dim nms As String
Dim colr As Int

lat = dbcursor.GetDouble("Field1") ' Lat
lng = dbcursor.GetDouble("Field2")  'Lng
nms = dbcursor.GetString("Field3") ' Name
colr = dbcursor.GetInt("Field4")    'Color

gmap.AddMarker2(lat,lng,nms,colr) 

Next
dbcursor.Close
 
Upvote 0

susu

Well-Known Member
Licensed User
Longtime User
And you should delete DoEvents
Move
Dim lat, lng As Double
Dim nms As String
Dim colr As Int

out of For ... Next ... too
 
Upvote 0
Top