Thứ Hai, 22 tháng 5, 2017

Những lỗi khi tạo cở sở dữ liệu với ADO.NET Entity Data Model

1. "Please see the Error List for more details. These issues must be fixed before running your application.
Loading metadata from the database took 00:00:00.6861134.
Generating the model took 00:00:01.7076731.
Added the connection string to the App.Config file.
Writing the .edmx file took 00:00:00.0003909.
The model was generated with warnings or errors."
=> Khắc phục:
  1. Click phải file *.edmx -> Open with XML editor
  2. Tìm các dòng "" --> nội dung lỗi sẽ nói rõ lỗi hiện tại là gì.
  3. Thông thường là do khi tạo csdl bạn quên khai báo khóa chính.
2. "The specified named connection is either not found in the configuration, not intended to be used with the EntityClient provider, or not valid."
=> Lỗi này thường gặp khi bạn cố gắng tạo tập tin *.edmx ở một project khác và để khắc phục lỗi này bạn chỉ cần tạo file app.config ngay tại project chính và copy dòng khai báo kết nối csdl từ file app.config của project chứa tập tin *.edmx => ok