Converting SQL to LINQ to XML
- by Morano88
I'm writing the following code to convert SQL to LINQ and then to XML:
SqlConnection thisConnection = new SqlConnection(@"Data Source=3BDALLAH-PC;Initial Catalog=XMLC;Integrated Security=True;Pooling=False;");
thisConnection.Open();
XElement eventsGive =
new XElement("data",
from c in ??????
select new XElement("event",
new XAttribute("start", c.start),
new XAttribute("end",c.eend),
new XAttribute("title",c.title),
new XAttribute("Color",c.Color),
new XAttribute("link",c.link)));
Console.WriteLine(eventsGive);
The name of the table is "XMLC" and I want to refer to it. How can I do that?
When I put its name directly VS gives an error. Also when I say thisConnection.XMLC it doesn't work.