locked
Update Model from database error. RRS feed

  • Question

  • Hello everyone. I'm new in c# and asp.net mvc5.

    I meet an error and mistakes.

    I changed my mssql database table. add a column to my table. After save right-clicked at model in visual-studio. I choose "Update Model from Database" From "Refresh" tab. Select the table which will refreshed. after refresh tables and run the program. I meet errors.

    Normally

       private PERKONEntities db = new PERKONEntities();

    it's my database connection. I create this connection with ADO.NET Entity Data Model.

    Error    CS0246    The type or namespace name 'PERKONEntities' could not be found (are you missing a using directive or an assembly reference?)    WebApplication1    C:\Users\lenovo\documents\visual studio 2015\Projects\WebApplication1\WebApplication1\Controllers\kullanicisController.cs    15    Active

    Can anyone help me?

    Thursday, August 3, 2017 7:29 AM

All replies

  • Well in order to use the EF model, then the project must have reference to it, if EF is in another project. Also if using EF in a method, a 'using' statement must point to the model.
    Thursday, August 3, 2017 1:33 PM
  • Hi ismail,

    If the PERKONEntities file in your project model folder, please add the following code on the code.

    using yournamespace.Models

    you could also move the mouse on the code PERKONEntities, which could generate a yellow bulb, click the Inverted triangle, select related using. like this:

    Best regards,

    Cole


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Friday, August 4, 2017 8:05 AM