O'Reilly Forums: Ch9 - Data Binding Problem - O'Reilly Forums

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Ch9 - Data Binding Problem

#1 User is offline   Swedishchef 

  • New Member
  • Pip
  • Group: Members
  • Posts: 3
  • Joined: 23-December 11

Posted 23 December 2011 - 12:12 PM

Hiya to all..

Excellent book. Have learned loads.

With reference to Chapter 9. I have managed to ceate the form as per Figure 9-5, attached the binding source and navigator and I have attached the code from Example 9-1.

I have built the project and no data has been displayed on the form. The form that is running is from Figure 9-5. I cannot explain where the data has gone to:

Any suggestions would be useful

Thanks in advance
0

#2 User is offline   JulieLerman 

  • Advanced Member
  • PipPipPipPipPipPipPipPip
  • Group: O'Reilly Author
  • Posts: 334
  • Joined: 17-September 08

Posted 23 December 2011 - 12:28 PM

Would you mind download the chapter 9 example from
http://learnentityfr.../downloads/#2ed
to see what's different?

Julie
0

#3 User is offline   Swedishchef 

  • New Member
  • Pip
  • Group: Members
  • Posts: 3
  • Joined: 23-December 11

Posted 23 December 2011 - 12:37 PM

View PostJulieLerman, on 23 December 2011 - 12:28 PM, said:

Would you mind download the chapter 9 example from
http://learnentityfr.../downloads/#2ed
to see what's different?

Julie


Many thanks for the quick reply. Considering I have just started with ch 9. The code I have used is:

var context = new BAGA.BAEntities();
List<BAGA.Customer> customers =
context.Customers.Include("Contact")
.Include("PrimaryActivity")
.Include("SecondaryActivity")
.Include("PrimaryDestination")
.Include("SecondaryDestination")
.Include("Reservations.Trip.Destination")
.ToList();

customerBindingSource.DataSource = customers;

This looks the same as the original query that was commented out.
0

#4 User is offline   JulieLerman 

  • Advanced Member
  • PipPipPipPipPipPipPipPip
  • Group: O'Reilly Author
  • Posts: 334
  • Joined: 17-September 08

Posted 23 December 2011 - 01:00 PM

can you debug and see if your getting any data in the customers variable before its binding?
0

#5 User is offline   Flyware 

  • New Member
  • Pip
  • Group: Members
  • Posts: 6
  • Joined: 03-January 12

Posted 04 January 2012 - 01:02 PM

View PostSwedishchef, on 23 December 2011 - 12:37 PM, said:

Many thanks for the quick reply. Considering I have just started with ch 9. The code I have used is:

var context = new BAGA.BAEntities();
List<BAGA.Customer> customers =
context.Customers.Include("Contact")
.Include("PrimaryActivity")
.Include("SecondaryActivity")
.Include("PrimaryDestination")
.Include("SecondaryDestination")
.Include("Reservations.Trip.Destination")
.ToList();

customerBindingSource.DataSource = customers;

This looks the same as the original query that was commented out.


Have you got this going yet? This may sound obvious, but have you confirmed there is data in the database? One of the downloads of BreakAway was for schema only. I think you need to use the .exe to load data.

Martin
0

#6 User is offline   Swedishchef 

  • New Member
  • Pip
  • Group: Members
  • Posts: 3
  • Joined: 23-December 11

Posted 05 January 2012 - 03:15 AM

View PostFlyware, on 04 January 2012 - 01:02 PM, said:

Have you got this going yet? This may sound obvious, but have you confirmed there is data in the database? One of the downloads of BreakAway was for schema only. I think you need to use the .exe to load data.

Martin


Having looked at the problem again and checking the database, it appears that the re-naming of the navigation properties had not been completed to what was stated in the book. Considering this is the first time I have used EF, this was a little difficult to follow. Once the navigation properties had been renamed, the example in ch 9 is working fine.

Many thanks to all who have suggested a possible solution to the identified problem.

Just one other issue that seems to be lacking, how do we deal with EF with a project that has multiple forms. Any suggestions on possible sample projects or further reading ?

Paul
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users