I am trying to populate Google Maps V3 with Multiple Markers from SQL Server 2012 Database table.
i am saving the latitude longitude in one column called GPS in this format 11.5642078,104.905664
my problem is the markers is show only one record do not appear all Marker in the maps. Mean that if in table have 20 record it will show 20 marker in maps, But now it can show only one marker in maps.
Please help me.
Thanks in advance
I have table tblGPS in SQL Server
No
ComName
GPS
Introduction
1
Capitol Guest house & Restaurant
11.5643076,104.9055242
Gust House
2
Sophal Thavy Guest house
11.5526978,104.8258317
House
HTML Code:
,
C# code:
C#
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespaceKoreanTeam.CMaps
{
publicpartialclassMapViews : System.Web.UI.Page
{
protectedvoidPage_Load(object sender, EventArgs e)
{
if (!this.IsPostBack)
{
DataTable dt = this.GetData("select * from tblGPS");
rptMarkers.DataSource = dt;
rptMarkers.DataBind();
}
}
private DataTable GetData(string query)
{
string conString = ConfigurationManager.ConnectionStrings["Con"].ConnectionString;
SqlCommand cmd = new SqlCommand(query);
using (SqlConnection con = new SqlConnection(conString))
{
using (SqlDataAdapter sda = new SqlDataAdapter())
{
cmd.Connection = con;
sda.SelectCommand = cmd;
using (DataTable dt = new DataTable())
{
sda.Fill(dt);
return dt;
}
}
}
}
}
}
Rashmiranjan DalabeheraRank #2,058 · 697 pointsPosted Sep 23, 2015, 3:57 AM EDT