As a side note to not intermix issues, this has nothing to do with sql.
In c#, you could do the same kind of thing like below. VB is essencially doing the same thing behind the covers. With some new DSL language/library stuff they are working on (shown here on c9), we may be able to do the same thing in c# without adding it to the language.
// Create memory list.
Employees emp1 = new Employees() {FirstName="Bill", LastName="Gates" };
Employees emp2 = new Employees() {FirstName="Don", LastName="Box" };
List<Employees> list = new List<Employees>() { emp1, emp2 };
// Create xml from a data source.
XElement xml = new XElement("employees",
from emp in list
select new XElement("employee",
new XElement("firstName", emp.FirstName),
new XElement("lastName", emp.LastName))
);
Console.WriteLine(xml.ToString());
Output:
<employees>
<employee>
<firstName>Bill</firstName>
<lastName>Gates</lastName>
</employee>
<employee>
<firstName>Don</firstName>
<lastName>Box</lastName>
</employee>
</employees>
btw - how come the insert code gives strange 1 line results? I had to just paste text.