代码:
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
<spanstyle="color:#222222;font-family:'HelveticaNeue',Helvetica,Arial,sans-serif;font-size:13px;line-height:22.1px;background-color:#FFFFFF;">CentOS7.0上面安装GB2312了吗 你的数据库应该是GB2312的<divclass='ref'>
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。