Passing a value to a null value column in Sql

I have a partition table, and in this table I have the columns SectionId, CourseId, Name, Capacity .... here CourseId is a column with a zero value, and its Foreignkey here is focused on the Cousrse table .... this CourseId column is recently added.

I am trying to add entries to this table using an entity structure in the Entiry infrastructure, which displays all column names except this CourseId, and when I send data to this section table, all data except the course ID is fine ... value courseId is saved as Null ...

how can I pass CourseId to this column ...... can someone help me here

+3
source share
2 answers

If EF does not show your column, you may need to update your model. Start there.

  • Open the .edmx file
  • Right click on design surface
  • Select "Update Model From Database"
  • Follow the instructions.
+4
source

Thanks everyone for the kind answers on ur, I found out about the soul, I solved the problem, sort of

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();
0
source

All Articles