无法解决“Latin1_General_CI_AS”与“Latin1_General_CI_AS”之间的排序规则冲突。和“SQL_Latin1_General_CP1_CI_AS”在等于操作中
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>();
}
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>();
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
排序规则是指用于在文本字段中存储数据的字符集,是为世界上所有多种书面语言提供支持所必需的。每列可以定义特定的排序规则,或者继承数据库的排序规则。比较具有不同排序规则的列时可能会遇到麻烦,因为一种排序规则中的字符不一定等同于另一种排序规则中的相同字符。
此比较中的列具有不同的排序规则:
empView.ID_NO 等于 empTable.EmployeeIDCard
或者,此比较中的列具有不同的排序规则:
empTable.SchemeID 等于 s.SchemeID
因此,您需要更改排序规则,以便它们在您的数据库架构上相同:
或者您可以将
整理数据库默认值
添加到底层sql中的每个比较中。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.
Either, the columns in this comparison have different collations:
empView.ID_NO equals empTable.EmployeeIDCard
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:
Or you can add
collate database default
to each of the comparisons in the underlying sql.