views:

40

answers:

2

I'm trying to convert DataTable to Linq using

DIm result = From r in dt.AsEnumerable()
             Select new ( col1 = r.Field<integer>("id"), col2 = r.Field<string>("desc"))

But i get error near 'new (' saying type expected.

What is wrong with this query?

+1  A: 

http://msdn.microsoft.com/en-us/library/bb531249.aspx says to use the syntax

New With { ... }
Jimmy
it worked but when i try to use result to do another linq query on it says result not declared
rs
A: 

I thought it was New { ... }

Andrew Backer