sqlite select 后 显示乱码

yongfa365 2008-10-04 03:23:47
private void button2_Click(object sender, EventArgs e)
{
string SQLiteName = @"D:\Personal\My Documents\123.db";
SQLiteConnection connection = new SQLiteConnection();
connection.ConnectionString = "Data Source=" + SQLiteName;
connection.Open();
SQLiteCommand command = connection.CreateCommand();
command.Connection = connection;
SQLiteTransaction transaction = connection.BeginTransaction();
try
{
command.CommandText = "select * from hehe";
command.ExecuteNonQuery();
DataSet ds = new DataSet();
SQLiteDataAdapter da = new SQLiteDataAdapter(command);
da.Fill(ds);
dataGridView1.DataSource = ds.Tables[0];
transaction.Commit();
}
catch
{
transaction.Rollback();
}
command.Dispose();
connection.Close();
}
...全文
380 11 打赏 收藏 转发到动态 举报
写回复
用AI写文章
11 条回复
切换为时间正序
请发表友善的回复…
发表回复
yongfa365 2008-12-17
  • 打赏
  • 举报
回复
还是没解决
homejiji 2008-10-14
  • 打赏
  • 举报
回复
[Quote=引用 8 楼 xsm545 的回复:]
看下字集 用UTF8
[/Quote]

Sqlite3内部采用UTF8存储
homejiji 2008-10-14
  • 打赏
  • 举报
回复
[Quote=引用 8 楼 xsm545 的回复:]
看下字集 用UTF8
[/Quote]

Sqlite3内部采用UTF8存储
xsm545 2008-10-14
  • 打赏
  • 举报
回复
看下字集 用UTF8
zbking 2008-10-14
  • 打赏
  • 举报
回复
用gb2312
yongfa365 2008-10-14
  • 打赏
  • 举报
回复
再顶一下
zlkingdom 2008-10-06
  • 打赏
  • 举报
回复
中文乱码一般都是字符集的问题,一般调整一下你程序的字符集就可以了
yongfa365 2008-10-05
  • 打赏
  • 举报
回复
顶一下
yongfa365 2008-10-04
  • 打赏
  • 举报
回复
所有中文都显示乱码


如果那个sqlite是我用程序建的再用上面的代码就没问题,如果是用别的SQLite工具建的就会显示乱码
Annie_Cai 2008-10-04
  • 打赏
  • 举报
回复
所有的都是乱码?还是部分是乱码?
NowtAngell 2008-10-04
  • 打赏
  • 举报
回复
不知道你是分解哪个字符串,位置.
上面没发现

110,568

社区成员

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

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

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