I am Using Google maps api v3 and want to make markers using loop in JS on also display the data on infowindow from Db.I want to make markers on map as i add row into DB.
The work have i done fot this is bellow but i unable to Compelete my target.
<% Dim con As New OleDbConnection
con = New OleDbConnection("Data Source=sml; User ID=sml; Password=sml; provider=OraOLEDB.Oracle")
con.Open()
Dim cmd As OleDbCommand = New OleDbCommand("Select STA_NAME, GPS_ONE from GPS", con)
Dim ds As New DataSet
Dim I As Long
Dim da As New OleDbDataAdapter(cmd)
da.Fill(ds, "GPS")
For I = 0 To ds.Tables("GPS").Rows.Count - 1
Dim GPS As String = ds.Tables("GPS").Rows(I).Item("GPS_ONE")
Next
%>
And JS code in map function to make marker
var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
var infowindow = new google.maps.InfoWindow();
var GPS='<%=GPS %>'
var Infowindow=GPS
var image = 'ico/Ch.png';
var LatLng = new google.maps.LatLng(GPS);
var marker0 = new google.maps.Marker({
draggable: true,
position: LatLng,
map: map,
icon:image,
title:""
});
google.maps.event.addListener(marker0, 'click', function() {
infowindow.setContent(Infowindow);
infowindow.open(map,marker0);
});
Through this code i am unalbe to make even one marker.I want to create marker on map as i add GPS in DB Column
google.maps.LatLng requires two arguments. You are using one: GPS. Since you don’t say what the value of GPS looks like, this should get you started.
replace:
with:
replace:
with: