DATABASE NOT WORKING AFTER UPDATING THE TABLE IN VISUAL STUDIO 2012

Simond Gear

Total Post:26

Points:182
Posted by  Simond Gear
 533  View(s)
Ratings:
Rate this:
Hi All,
I have getting error after updating tables directly in sql server 2012, it will through error in my MVC application. Error is below:

Server Error in '/' Application. Invalid column name 'Id'. Invalid column name 'Id'.


Here, My Table is below:


CREATE TABLE [dbo].[Course](
       [ID] [int] IDENTITY(1,1) NOT NULL,
       [Title] [nvarchar](50) NULL,
       [Credits] [int] NOT NULL,
       [DepartmentID] [int] NOT NULL,
 CONSTRAINT [PK_dbo.Course] PRIMARY KEY CLUSTERED
(
       [ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]


Please can anyone help.

Thank you.


  1. Anupam Mishra

    Post:135

    Points:949
    Re: Database not working after updating the table in Visual studio 2012

    Hi Simond,


     If you are using edmx, Then follow the following steps:

     1. Open edmx diagram & Delete the Course table diagram
     2. Add the Course  table once again
     3.  save and build the application
     4. Debug the project

    Otherwise, if you are using CodeFirst Approach then, you need to update the database.

      Modified On Mar-25-2016 04:06:20 AM

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!