Server Error in '/WebSite1' Application.
Cannot resolve the collation conflict between "Chinese_PRC_CI_AS" and "SQL_Latin1_General_CP1_CI_AS" in the equal to operation.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Data.SqlClient.SqlException: Cannot resolve the collation conflict between "Chinese_PRC_CI_AS" and "SQL_Latin1_General_CP1_CI_AS" in the equal to operation.
Source Error:
The source code that generated this unhandled exception can only be shown when compiled in debug mode. To enable this, please follow one of the below steps, then request the URL: |
Stack Trace:
复制代码
|
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.1
用户反馈,程序出现上面Error,无法解析的排序规则冲突。两台服务器,一台(前者)SQL Server的排序规则为“ Chinese_PRC_CI_AS ”另一台(后者)SQL Server 服务器排序规则为“SQL_Latin1_General_CP1_CI_AS ”
后者服务器创建前者为链接服务器。因为不能对两台服务器排序规则作过多修改。只好去修改存储过程,修改前代码(部分):


DROP TABLE dbo.#TempWipStocks
CREATE TABLE dbo.#TempWipStocks
(
[ Location ] NVARCHAR ( 30 ),
[ ItemCode ] NVARCHAR ( 60 ),
[ Description ] NVARCHAR ( 100 ),
[ CustomerID ] NVARCHAR ( 30 ),
[ Quantity ] DECIMAL ( 18 , 2 ),
[ Allocated ] BIT ,
[ Allocatee ] NVARCHAR ( 200 )
)
-- 从链接服务器查询到数据再插入这个临时表中。
INSERT INTO dbo.#TempWipStocks SELECT * FROM [ dbo ] . [ udf_WipStocks ] ()
修改后代码(部分):


DROP TABLE dbo.#TempWipStocks
CREATE TABLE dbo.#TempWipStocks
(
-- Insus.NET作了如下一些修改,只对字符型的字段添加链接服务器的排序规则
[ Location ] NVARCHAR ( 30 ) COLLATE Chinese_PRC_CI_AS,
[ ItemCode ] NVARCHAR ( 60 ) COLLATE Chinese_PRC_CI_AS,
[ Description ] NVARCHAR ( 100 ) COLLATE Chinese_PRC_CI_AS,
[ CustomerID ] NVARCHAR ( 30 ) COLLATE Chinese_PRC_CI_AS,
[ Quantity ] DECIMAL ( 18 , 2 ),
[ Allocated ] BIT ,
[ Allocatee ] NVARCHAR ( 200 ) COLLATE Chinese_PRC_CI_AS
)
INSERT INTO dbo.#TempWipStocks SELECT * FROM [ dbo ] . [ udf_WipStocks ] ()
存储过程修改更新之后,程序在运行时跑出正常介面了。
最后
以上就是畅快奇迹最近收集整理的关于Cannot resolve the collation conflictServer Error in '/WebSite1' Application. 的全部内容,更多相关Cannot内容请搜索靠谱客的其他文章。
发表评论 取消回复