tags:

views:

65

answers:

1

Hi guys,

Following on from my previous question, I am getting another compilation error on my Linq query:

Compiler Error Message: CS1002: ; expected

Source Error:

Line 42:  XElement xml = XElement.Load(Server.MapPath("/members/listmembersxmlfeed?gid" + gid));
Line 43: 
Line 44:  var query = from p in xml.Descendants("member")
Line 45:    select new
Line 46:    {

This is the entire procedure:

protected void exportList(Object sender, EventArgs e)
{
    String gid;
    gid = Request.QueryString["gid"].ToString();
    XElement xml = XElement.Load(Server.MapPath("/members/listmembersxmlfeed?gid" + gid));

        var query = from p in xml.Descendants("member")
                select new
                {
                    Name = p.Element("name").Value,
                    Email = p.Element("email").Value
                };

        foreach (var member in query)
        {
                Response.Write("Employee: " + member.Name + " " + member.Email + "<br />");
        }
}

I've checked the code against the example on the Microsoft website and it looks good. I've also checked to see if 3.5 is referenced correctly for the website, which I believe it is.

Thanks.

A: 

I copied the web.config into Visual Studio and changed the build to 3.5 in the properties, this seems to have solved the problem. Clearly there was a reference missing, but I am at a loss as to which one it was.

Thanks for all your help.

Gogster