Lỗi: namespace name 'entitystate' does not exist in 'system.data'

Thảo luận trong 'Lập Trình Website MVC5 & MVC6' bắt đầu bởi admin, 3/8/18.

  1. admin
    Tham gia ngày:
    22/5/13
    Bài viết:
    4,904
    Đã được thích:
    1,199
    Điểm thành tích:
    113
    Giới tính:
    Nam
    dbc.Entry(model).State = System.Data.EntityState.Modified bị Lỗi: the type or namespace name 'entitystate' does not exist in the namespace 'system.data' (are you missing an assembly reference ?) khi save update dữ liệu web asp.net mvc C# xuống cơ sở dữ liệu linq, sql server. Tự nhiên nó bị lỗi như vậy thì các bạn làm như sau:

    Cách 1: kiểm tra xem đã using nó chưa?
    • usingSystem.Data;
    • usingSystem.Data.Entity;
    Cách 2: chuyển đổi thêm
    • Đổi từ: System.Data.EntityState.Modified;
    • Sang: System.Data.Entity.EntityState.Modified;
    Cách 3: Kiểm tra lại web.config
    Mã:
    <configSections>
    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
    </configSections>
    
    Thành hoặc ngược lại
    Mã:
    <configSections>
    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
    </configSections>
    
    Cách 4: xem thêm ở trang Microsoft
     
    Cảm ơn đã xem bài:

    Lỗi: namespace name 'entitystate' does not exist in 'system.data'



Chủ để tương tự : Lỗi namespace
Diễn đàn Tiêu đề Date
Lập Trình Website MVC5 & MVC6 Lỗi: You are debugging a Release build of .dll. Using just My Code in Visual Studio 2019 8/6/23
Lập Trình Website MVC5 & MVC6 Lỗi: There is already an open DataReader associated with this Command which must be closed first 30/10/20
Lập Trình Website MVC5 & MVC6 Lỗi: The LINQ expression node type 'ArrayIndex' is not supported in LINQ to Entities. 27/3/20
Lập Trình Website MVC5 & MVC6 Lấy Entity Value old cũ sau đó Update không bị lỗi Asp.net MVC 27/3/20
Lập Trình Website MVC5 & MVC6 Lỗi Maximum request length exceeded khi upload file mvc asp.net c# 5/8/19