Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
LINQ to datatable - how to create a variable?
Message
From
01/07/2013 15:25:01
John Baird
Coatesville, Pennsylvania, United States
 
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Environment versions
Environment:
C# 4.0
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Web
Miscellaneous
Thread ID:
01576896
Message ID:
01577555
Views:
43
>I am now trying to declare a variable with anonymous type and I can not figure out how to declare this variable correctly. The showed declaration doesn't help me
>
>
>var query = dtBookings.AsEnumerable().Select(c => new
>    {
>       booking_id = c.Field<Decimal>("booking_id"),
>       lname = c.Field<String>("lname"),
>       start_time = c.Field<DateTime?>("start_time"),
>       end_time = c.Field<DateTime?>("end_time"),
>       flex_tspan = c.Field<Boolean>("flex_tspan"),
>       layer = c.Field<Byte>("layer"),
>       backcolor = c.Field<Int32>("backcolor"),
>       forecolor = c.Field<Int32>("forecolor"),
>       clip_loc = c.Field<Boolean>("clip_loc"),
>       clip_sp = c.Field<String>("clip_sp"),
>       display_msg = "#Slots: " + c.Field<Int16>("num_addit").ToString() + " " + c.Field<String>("display_msg"),
>       isnotes = c.Field<Boolean>("isnotes"),
>       bookingType = "POD"
>    });
and the problem is?
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform