Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Returning record versus fields only
Message
From
09/04/2012 18:31:39
 
 
To
09/04/2012 15:50:54
General information
Forum:
ASP.NET
Category:
LINQ
Environment versions
Environment:
VB 9.0
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Web
Miscellaneous
Thread ID:
01540661
Message ID:
01540741
Views:
29
>Are you sure that worked and didn't just compile? The OfType function will only return the results of your query that match a particular type. This guarantees that your query is returning an IEnumerable or IQueryable list of type IQueryable. If however your result set contains objects of an anonymous type, you will simply get no results, since no objects in your result set match that type. It will compile, but you will always get nothing.
>
>I think that in order to get the results you are looking for, your select clause needs to return an object of type ClientAPI.ClientService.Client. I would try the following:
oClient = (From c
>                 In oGeneric.GetClients()
>                 Where c.Id = nClientID
>                 Select new ClientAPI.ClientService.Client() { FirstName = c.FirstName, LastName = c.cLastName} ).FirstOrDefault()
I tried that syntax and everything is intellisense except the FirstName and LastName, the ones just before the equal signs. This one generates design time error:

"Name 'FirstName' is either not declared or not in the current scope."

I am trying to see if this is just a syntax error. That seems like an interesting approach.
Michel Fournier
Level Extreme Inc.
Designer, architect, owner of the Level Extreme Platform
Subscribe to the site at https://www.levelextreme.com/Home/DataEntry?Activator=55&NoStore=303
Subscription benefits https://www.levelextreme.com/Home/ViewPage?Activator=7&ID=52
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform