string dosya_adres = @"C:\Users\...\Desktop\exam.xls"; OleDbConnection baglanti = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + dosya_adres + ";Extended Properties=Excel 8.0"); baglanti.Open(); string query = "select * from [Sayfa1$] "; OleDbDataAdapter oAdp = new OleDbDataAdapter(query, baglanti); DataTable tbl = new DataTable(); oAdp.Fill(tbl); //GridView1.DataSource = tbl; //GridView1.DataBind(); row = tbl.Rows.Count; int i = 0; String Locations = ""; foreach (DataRow r in tbl.Rows) { // bypass empty rows if (r["Latitude"].ToString().Trim().Length == 0) continue; string Latitude = r["Latitude"].ToString(); string Longitude = r["Longitude"].ToString(); // create a line of JavaScript for marker on map for this record Locations += Environment.NewLine + "var marker" + i.ToString() + @" = new google.maps.Marker({ position: new google.maps.LatLng (" + Latitude + ", " + Longitude + @"), map: map });"; i++; } // construct the final script js.Text = @"<script type='text/javascript'> var latlng = new google.maps.LatLng(37.8666667, 32.4833333); var myOptions = { zoom: 13, center: latlng, mapTypeId: google.maps.MapTypeId.ROADMAP }; function initialize() { var map = new google.maps.Map(document.getElementById('mapdiv'), myOptions); " + Locations + @" } </script> ";
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)