title: "missing using directive" pass data from sql database to view asp.net mvc3 c#
body: <p>I have seen codes passing model data to the view but I have not seen anyone pass data from the sql database to the view. I'm trying to pass my data from the sql database to the view so that I can view it on my webpage. I always get an error saying missing using directive. </p>
  
  <pre><code> "CS1061: 'System.Collections.Generic.IEnumerable' does not contain a definition for 'longitude' and no extension method 'longitude' accepting 
   a first argument of type 'System.Collections.Generic.IEnumerable' could be found (are you missing a using directive or an assembly reference?)"
  </code></pre>
  
  <p>I'm missing something..anyone know?? Thanks.</p>
  
  <p>Here is my code. I'm trying to get the longitude and latitude from my database.</p>
  
  <p>Home Controller Code</p>
  
  <pre><code>    public ActionResult Index()
      {
          var ldc = new locationDataContext();
          var loc = (from l in ldc.locationModels select l).First();
          return View(loc);
      }
  </code></pre>
  
  <p>Index View Code</p>
  
  <pre><code>@model IEnumerable&lt;googleMap2.Models.locationModel&gt;
  @{ 
      ViewBag.Title = "MVC 3 and Google Maps"; 
  }
  
  @section Scripts { 
      &lt;script type="text/javascript"  src="http://maps.google.com/maps/api/js?sensor=false"&gt;&lt;/script&gt;
  }
  
  @section Styles { 
      html { height: 80% } 
      body { height: 80%; margin: 0px; padding: 0px } 
      #map_canvas { height: 80% } 
  }
  
  &lt;h2&gt;Hello, Google Maps&lt;/h2&gt;
  
  &lt;div id="map_canvas" style="width:80%; height:80%"&gt;&lt;/div&gt;
  
  &lt;script type="text/javascript"&gt;
  
      function initialize() {
          var latlng = new google.maps.LatLng(@Model.longitude, @Model.latitude);
          var options = { zoom: 14, center: latlng, mapTypeId: google.maps.MapTypeId.ROADMAP };
          var map = new google.maps.Map(document.getElementById("map_canvas"), options);
          //google.maps.event.trigger(map, 'resize');
      }
  
      $(function () {
          initialize();
      }); 
  
  &lt;/script&gt;
  </code></pre>