开发者社区> 问答> 正文

mono c#连接windows sqlserver 936异常?报错

代码:

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

展开
收起
爱吃鱼的程序员 2020-06-09 15:41:20 698 0
1 条回答
写回答
取消 提交回答
  • https://developer.aliyun.com/profile/5yerqm5bn5yqg?spm=a2c6h.12873639.0.0.6eae304abcjaIB

    <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'>

    引用来自“Ghostab”的评论

    <spanstyle="color:#222222;font-family:'HelveticaNeue',Helvetica,Arial,sans-serif;font-size:13px;line-height:22.1px;background-color:#FFFFFF;">CentOS7.0上面安装GB2312了吗  你的数据库应该是GB2312的

    2020-06-09 15:41:37
    赞同 展开评论 打赏
问答排行榜
最热
最新

相关电子书

更多
《云服务器运维之Windows篇》 立即下载
TAKING WINDOWS 10 KERNEL 立即下载
ECS运维指南之Windows系统诊断 立即下载