Reputation: 1984
I have a Sections table and in that table I have columns SectionId,CourseId,Name,Capacity....here the CourseId is a null value column and its the Foreignkey here which focuses the Cousrse table....this CourseId column is a newly added one.
I am trying to add records to this table, am using entity framework, in the Entiry framework its showing all the column names except this CourseId, and when I send the datas to this Sections table all the datas except Course Id are stored fine...the value of courseId is stored as Null...
how can I pass the CourseId to this column......can anyone help me here
Upvotes: 3
Views: 242
Reputation: 1984
Thanks everybody for ur kind responses, I found out the soultion, I solved the issue like
Public int CourseId
{
get;
set;
}
DataObject.Entities dataEntities=new DataObject.Entities();
DataObject.Section section=dataEntities.Sections.CreateSections(0
,Name
,Code
,Capacity);
section.CourseId=CourseId;
dataEntities.Sections.AddObject(section);
dataEntities.SaveChanges();
Upvotes: 0
Reputation: 4296
If EF is not showing your column, you may need to refresh your model. Start there.
Upvotes: 4