无法解决“Latin1_General_CI_AS”与“Latin1_General_CI_AS”之间的排序规则冲突。和“SQL_Latin1_General_CP1_CI_AS”在等于操作中

发布于 2024-10-20 08:27:24 字数 716 浏览 0 评论 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>();
}
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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

煮酒 2024-10-27 08:27:24

排序规则是指用于在文本字段中存储数据的字符集,是为世界上所有多种书面语言提供支持所必需的。每列可以定义特定的排序规则,或者继承数据库的排序规则。比较具有不同排序规则的列时可能会遇到麻烦,因为一种排序规则中的字符不一定等同于另一种排序规则中的相同字符。

  1. 此比较中的列具有不同的排序规则:

    empView.ID_NO 等于 empTable.EmployeeIDCard

  2. 或者,此比较中的列具有不同的排序规则:

    empTable.SchemeID 等于 s.SchemeID

因此,您需要更改排序规则,以便它们在您的数据库架构上相同:

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

或者您可以将整理数据库默认值添加到底层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.

  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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文