This question is locked. New answers and comments are not allowed.
Hi I am playing around within open access and having some issues.
I have created 2 entities as below
projectMaster projectStatus
Id Id
Name statusdesc
many to 1 relationship
This is mapped to below tables
project_master project_status
Id id
name typedesc
type_id
I then create a simple winform app with a few controls 2 textboxes 1 for ID and 1 for name and a lookupedit for status.
i then create a binding source
and set the datasource as below
var Projectmasterquery = from pm in dbcontext.projectMasters select pm;
projectMasterBindingSource.DataSource = Projectmasterquery.ToList();
and i setup another datasource to fill the lookupedit values like below
var querystatus = from p in dbcontext.projectStatus select p;
projectStatusBindingSource.DataSource = querystatus.ToList();
Now i bind the textboxes with
this.Project_id_textedit.DataBindings.Add(new System.Windows.Forms.Binding("EditValue", this.projectMasterBindingSource, "projectId", true));
this.ProjectName_textedit.DataBindings.Add(new System.Windows.Forms.Binding("EditValue", this.projectMasterBindingSource, "projectname", true));
and then i bind the lookupedit editvalue as below.
this.Status_lookupedit.DataBindings.Add(new System.Windows.Forms.Binding("EditValue", this.projectMasterBindingSource, "ProjectStatus.statusId", true));
When i run the app it loads the data fine for the 1 record in the database, and i can change the project name and .savechanges() and it records that save and updates the database however when i change the lookupedit value and click savechanges() nothing happens? am i doing something wrong I think im doing somethign wrong with the foreign key to the status table but it loads the value from there fine? i cant find any examples on binding textboxes and foreign keys on the web.
I have created 2 entities as below
projectMaster projectStatus
Id Id
Name statusdesc
many to 1 relationship
This is mapped to below tables
project_master project_status
Id id
name typedesc
type_id
I then create a simple winform app with a few controls 2 textboxes 1 for ID and 1 for name and a lookupedit for status.
i then create a binding source
and set the datasource as below
var Projectmasterquery = from pm in dbcontext.projectMasters select pm;
projectMasterBindingSource.DataSource = Projectmasterquery.ToList();
and i setup another datasource to fill the lookupedit values like below
var querystatus = from p in dbcontext.projectStatus select p;
projectStatusBindingSource.DataSource = querystatus.ToList();
Now i bind the textboxes with
this.Project_id_textedit.DataBindings.Add(new System.Windows.Forms.Binding("EditValue", this.projectMasterBindingSource, "projectId", true));
this.ProjectName_textedit.DataBindings.Add(new System.Windows.Forms.Binding("EditValue", this.projectMasterBindingSource, "projectname", true));
and then i bind the lookupedit editvalue as below.
this.Status_lookupedit.DataBindings.Add(new System.Windows.Forms.Binding("EditValue", this.projectMasterBindingSource, "ProjectStatus.statusId", true));
When i run the app it loads the data fine for the 1 record in the database, and i can change the project name and .savechanges() and it records that save and updates the database however when i change the lookupedit value and click savechanges() nothing happens? am i doing something wrong I think im doing somethign wrong with the foreign key to the status table but it loads the value from there fine? i cant find any examples on binding textboxes and foreign keys on the web.