Click here to Skip to main content
15,908,445 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
Hi
I am working on project base on Silverlight 5 .
I use data service for connection to sql database.

when i want to query database i must user DataServiceCollection<t> for loading my data into it.
I want to query database with like this code
C#
DataServiceCollection<?anonymousetype?> collection= new DataServiceCollection<?anonymousetype?>();
               collection.LoadAsync( from sContract in _entityService.Entity.SContracts
                       select new
                                   {
                                       ContractID = sContract.ContractID,
                                       SCNTTitle = sContract.SCNTTitle,
                                       ContractNum = sContract.ContractNum,
                                       ContractDate = sContract.ContractDate,
                                       SupervisionName = sContract.User.FirstName + " " + sContract.User.Family,
                                       CompnayName = sContract.Contractors_Counselors.CompanyName,
                                   });



but I got error

How can I query database that my Query return a anonymousetype with new keyword ???

thanks a lot
Posted

1 solution

Just use object as the return type.

rviceCollection<object> collection= new DataServiceCollection<object>();</object></object>
 
Share this answer
 
Comments
mohammadghaderian.bp 30-Jun-12 13:43pm    
object don not work . it throw an exception

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900