Note that there are some explanatory texts on larger screens.

plurals
  1. POThe type or namespace name 'var' could not be found in asp.net 2.0
    primarykey
    data
    text
    <p>I am using Asp.Net 2.0.I was trying to built an application on how to build a <a href="http://www.4guysfromrolla.com/articles/051910-1.aspx" rel="nofollow">Store Locator ASP.NET Application Using Google Maps API</a>.When I am trying to use "var" in the pplication it is giving error "The type or namespace name 'var' could not be found (are you missing a using directive or an assembly reference?)".</p> <p>I have downloaded the above article and is working correctly in vs2005.I wonder why the error comes in my project only ??</p> <p>Namespace i have used in the application</p> <pre><code>using System; using System.Collections.Generic; using System.Web; using System.Xml.Linq; using System.Linq; </code></pre> <p>Heres the class i have used </p> <pre><code>public static XElement GetGeocodingSearchResults(string address) { // Use the Google Geocoding service to get information about the user-entered address // See http://code.google.com/apis/maps/documentation/geocoding/index.html for more info... var url = String.Format("http://maps.google.com/maps/api/geocode/xml?address={0}&amp;sensor=false", HttpContext.Current.Server.UrlEncode(address)); // Load the XML into an XElement object (whee, LINQ to XML!) var results = XElement.Load(url); // Check the status var status = results.Element("status").Value; if (status != "OK" &amp;&amp; status != "ZERO_RESULTS") // Whoops, something else was wrong with the request... throw new ApplicationException("There was an error with Google's Geocoding Service: " + status); return results; } </code></pre> <p>The errors i am getting are as follows</p> <pre><code>Error 1 : The type or namespace name 'var' could not be found (are you missing a using directive or an assembly reference?) Error 2 : The best overloaded method match for 'System.Xml.Linq.XElement.Load(string)' has some invalid arguments Error 3:cannot convert from 'var' to 'string' </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload