mono c#连接windows sqlserver 936异常

89655408 发布于 2016/04/22 09:29
阅读 659
收藏 0

代码:

System.Data.SqlClient.SqlConnection conn = new System.Data.SqlClient.SqlConnection("server=192.168.8.25;database=testa;uid=testuser;pwd=test123456");

conn.Open();

在CentOS 7.0下使用mono部署运行提示No data is available for encoding 936. 

CentOS 6.5下运行一切正常

执行Open的时候报错如下:

No data is available for encoding 936. at System.Text.Encoding.GetEncoding (Int32 codepage) <0x7fd2c9ab27e0 + 0x004b9> in <filename unknown>:0 \n at Mono.Data.Tds.TdsCharset.GetEncodingFromLCID (Int32 lcid) <0x40c1edc0 + 0x000c9> in <filename unknown>:0 \n at Mono.Data.Tds.TdsCharset.GetEncodingFromLCID (System.Byte[] collation) <0x40c1ed90 + 0x00017> in <filename unknown>:0 \n at Mono.Data.Tds.TdsCharset.GetEncoding (System.Byte[] collation) <0x40c18e10 + 0x0004f> in <filename unknown>:0 \n at Mono.Data.Tds.Protocol.Tds.ProcessEnvironmentChange () <0x40c17d50 + 0x00517> in <filename unknown>:0 \n at Mono.Data.Tds.Protocol.Tds.ProcessSubPacket () <0x40c17200 + 0x001ab> in <filename unknown>:0 \n at Mono.Data.Tds.Protocol.Tds.NextResult () <0x40c16fc0 + 0x0008b> in <filename unknown>:0 \n at Mono.Data.Tds.Protocol.Tds.SkipToEnd () <0x40c16f10 + 0x00023> in <filename unknown>:0 \n at Mono.Data.Tds.Protocol.Tds70.Connect (Mono.Data.Tds.Protocol.TdsConnectionParameters connectionParameters) <0x40c152d0 + 0x00a4b> in <filename unknown>:0 \n at Mono.Data.Tds.Protocol.Tds80.Connect (Mono.Data.Tds.Protocol.TdsConnectionParameters connectionParameters) <0x40c152a0 + 0x00013> in <filename unknown>:0 \n at System.Data.SqlClient.SqlConnection.Open () <0x40c11120 + 0x008c4> in <filename unknown>:0

加载中
0
Ghostab
Ghostab
CentOS 7.0 上面安装GB2312了吗    你的数据库应该是GB2312的
0
89655408
89655408

引用来自“Ghostab”的评论

CentOS 7.0 上面安装GB2312了吗    你的数据库应该是GB2312的
非常感谢 Ghostab的回答,问题大致就是这样解决了。
OSCHINA
登录后可查看更多优质内容
返回顶部
顶部