Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Entity Framework 4: how to populate a datasource

Posted on 2010-11-17
1
Medium Priority
?
593 Views
Last Modified: 2013-11-26
Using EF4, how do I populate a datasoure for a drop down list using the entity framework?

            Dim personQuery As ObjectQuery(Of Person) = _
                From p In personContext.People.Include("Office") _
                Order By p.Name _
                Select p

                ddlDepartmentList.DataSource = CType(personQuery, ObjectQuery).Execute(MergeOption.AppendOnly)

Open in new window


Is that right?
0
Comment
Question by:Starr Duskk
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 96

Accepted Solution

by:
Bob Learned earned 2000 total points
ID: 34161090
You have a little too much going on there, and it can be pared down to something like this:

           
           Dim personQuery = _
                From p In personContext _
                Order By p.Name _
                Select p

                ddlDepartmentList.DataSource = personQuery
                ddlDepartmentList.DataBind()

Open in new window

0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…

721 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question