public List<EmployeesX> GetView()
{
   Health_Scheme_System.Health_Scheme_SystemDB db = new Health_Scheme_System.Health_Scheme_SystemDB();

   var d = from empView in db.EmployeeDirectories
           join empTable in db.Employees on empView.ID_NO equals empTable.EmployeeIDCard 
           join s in db.Schemes on empTable.SchemeID equals s.SchemeID 
           select new EmployeesX {ID_NO = empView.ID_NO, FIRST_NAME = empView.FIRST_NAME, LAST_NAME = empView.LAST_NAME, EMPLOYMENT_DATE = ((DateTime)empView.EMPLOYMENT_DATE).Date, TERMINATION_DATE = ((DateTime)empView.TERMINATION_DATE).Date, LOCATION_CODE = empView.LOCATION_CODE };
           return d.ToList<EmployeesX>();
}
1

There are 1 answers

1
sheikhjabootie On

Collation refers to the character set used to store data in text fields and is necessary to provide support for all of the many written languages of the world. Each column can have a specific collation defined, or else inherit the collation of the database. You can run into trouble when comparing columns with different collations as a character in one collation is not necessarily equivalent to the same character in another collation.

  1. Either, the columns in this comparison have different collations:

    empView.ID_NO equals empTable.EmployeeIDCard

  2. Or, the columns in this comparison have different collations:

    empTable.SchemeID equals s.SchemeID

So you need to either change the collations so that they are the same on your database schema:

ALTER TABLE MyTable ALTER COLUMN CharCol
            varchar(10)COLLATE Latin1_General_CI_AS NOT NULL

Or you can add collate database default to each of the comparisons in the underlying sql.