0
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>();
}
2

1 Answer 1

5

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.

1
  • @Malcolm - You're welcome. If that answered your question, then you can mark the answer as 'Accepted'. Then it'll have a big green tick so that other people with the same problem can see the solution. Mar 3, 2011 at 10:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.