F
Fritjolf
Hi.
I have some simple tables.
- ER_Person table (Person_Id, LogonId, FirstName, LastName, EMail)
- ER_Section table (Section_Id, SectionCode, SectionName)
- ER_PersonSection table (Person_Id, Section_Id)- this table takes
care of a many-to-many relationship between person and section. A
person can be connected to several sections and this table makes that
possible.
I'm using vs2008 and the objectdesigner.
In my application (Winforms) I retrieve a person:
var person = ProjectGlobal.rd.ER_Persons.Single(c => c.LogonId ==
ALogonId.ToUpper());
This is retrieved by the user entering a logonid in a textfield and
press fetch. The logonId is unique, enforced by business logic.
The person is fetched and I can change values and see that the
datacontext has pending updates, which it stores when I call the
datacontext.SubmitChanges();
This is a good, but then it comes to displaying the sections this
person is "attached to".
The person data is presented in textfields and is databound via a
BindingSource.
The sections for this person I would like to present in a grid.
var sections = from s in ProjectGlobal.rd.ER_Person_Sections
where s.ER_Person.LogonId ==
tefLogonId.Text.ToUpper() && s.ER_Person.Person_Id == s.Person_Id
select new { s.ER_Section.Section_Code,
s.ER_Section.SectionName };
Then I databind this result to the gridview.
the problem is that this probably isn't "best practices" and the other
problem is that I can't change or add new values....
Does anyone have any help regarding this master-detail problem... ?
and PLEASE don't just point me in the direction of a master grid
updating details in another grid...
Regards,
Fritjolf
I have some simple tables.
- ER_Person table (Person_Id, LogonId, FirstName, LastName, EMail)
- ER_Section table (Section_Id, SectionCode, SectionName)
- ER_PersonSection table (Person_Id, Section_Id)- this table takes
care of a many-to-many relationship between person and section. A
person can be connected to several sections and this table makes that
possible.
I'm using vs2008 and the objectdesigner.
In my application (Winforms) I retrieve a person:
var person = ProjectGlobal.rd.ER_Persons.Single(c => c.LogonId ==
ALogonId.ToUpper());
This is retrieved by the user entering a logonid in a textfield and
press fetch. The logonId is unique, enforced by business logic.
The person is fetched and I can change values and see that the
datacontext has pending updates, which it stores when I call the
datacontext.SubmitChanges();
This is a good, but then it comes to displaying the sections this
person is "attached to".
The person data is presented in textfields and is databound via a
BindingSource.
The sections for this person I would like to present in a grid.
var sections = from s in ProjectGlobal.rd.ER_Person_Sections
where s.ER_Person.LogonId ==
tefLogonId.Text.ToUpper() && s.ER_Person.Person_Id == s.Person_Id
select new { s.ER_Section.Section_Code,
s.ER_Section.SectionName };
Then I databind this result to the gridview.
the problem is that this probably isn't "best practices" and the other
problem is that I can't change or add new values....
Does anyone have any help regarding this master-detail problem... ?
and PLEASE don't just point me in the direction of a master grid
updating details in another grid...
Regards,
Fritjolf