views:

68

answers:

1

Hi, im working with Entity Framework, SQL and C#.

i have a Table called Client and other called clients_phone.

I have a form with a Xtragrid and using BindingSource I bind the IQueryable to the grid.

myBindingSource = new BindingSource();
myBindingSource.DataSource = clients;  //Clients it is the IQueryable<Client>
myBindingSource.DataMember = "clients_phone";
myBindingSource.AllowNew = true;

Then, i wan to add a new clients_phone to my client. To do this, i make a New Client() and then add the Phone.

clients newclient = objContext.CreateObject<clients>();

newclient.clients_phone = newClients_Phone;

objContext.AddObject("Clients", newclient);

Finally i add the new clients_phone in the ObjectContext, but when i see the Xtrag clients_phone don't show.

Any idea of what happens??.

Thanks

+1  A: 

Have you tried saving and commiting the object?

objContext.SaveChanges(true);

objContext.AcceptAllChanges();
Lucas B
No, because i have to add Many Clients_Phone to one Client. So, i can't savechange until all are added.
Mark Comix
Maybe I'm missing something, if you're not Saving the changes back to the database, how do you expect to see it in a grid that's bound to a database query?
Coding Gorilla