C#读数据库中varbinary类型,如何转换成中文

pengfangxu8 2012-01-11 01:43:52
List<string> list = new List<string>();
string sql = "select Chinese from phrases";
OdbcCommand myCommand = new OdbcCommand(sql, con);
OdbcDataReader reader = myCommand.ExecuteReader();
while (reader.Read())
{
Console.WriteLine(reader[0].ToString());
list.Add(reader[0].ToString());
}
数据库中Chinese字段的格式是varbinary类型,数据库中存了一些中文字串,我想得那些中文字串,目前得到的是System Byte[],请问各位大侠,该如何办,谢谢了,本人不懂,谢谢各位!
...全文
105 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
pengfangxu8 2012-01-11
  • 打赏
  • 举报
回复
谢谢您了,谢谢!
pengfangxu8 2012-01-11
  • 打赏
  • 举报
回复
大侠,是乱码,再请教哈
Hassle 2012-01-11
  • 打赏
  • 举报
回复
Encoding.Default.GetString((byte[])reader.GetValue(0))

110,539

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧