This is my code in my model, I want to use the variable lat to my view. Is there a way to use it there?
The string has a lat and lng with it. What I want to happen is when the string is selected in the text the lat and lng is selected as well but it will be stored in the variable and I will use it in the view and pass it to the script where it will view it in the google map api.
public IEnumerable<String> GetStartList()
{
//int count = 0;
var result = new List<String>(10);
string query = "SELECT PlaceName, Lat, Lng from Places";
SqlCommand cmd = new SqlCommand(query, con);
con.Open();
using (SqlDataReader dr = cmd.ExecuteReader())
{
while (dr.Read())
{
var mystring = dr.GetString(0);
var lat = dr.GetDouble(1);
result.Add(mystring);
//result.Add(lat.ToString());
//count++;
}
}
con.Close();
return result;
}