private void Task_Click(object sender, EventArgs e)
{ conn = new SQLiteConnection();
String ConnString = String.Empty;
ConnString = "Data Source=Data.s3db;New=False;Compress=True;Synchronous=Off;UTF8Encoding=True;Version=3";
String sql = String.Empty;
sql = " select mail_title from mail_table";
//Functions.SqliteExcute.TaskFillListView(this.TaskList, sql ,conn);
SQLiteCommand cmd = new SQLiteCommand();
cmd.Connection = conn;
cmd.CommandText = sql;
conn.Open();
SQLiteDataReader read = cmd.ExecuteReader(); this.TaskList.Items.Clear(); while (read.Read())
{
ListViewItem items = new ListViewItem();
items.SubItems.Clear();
items.Text = read[0].ToString();
TaskList.Items.Add(items);
}
read.Close();
conn.Close(); }
值包含中文,可顯示的都是亂碼,等高人解答。
private void Task_Click(object sender, EventArgs e)
{ conn = new SQLiteConnection();
String ConnString = String.Empty;
ConnString = "Data Source=Data.s3db;New=False;Compress=True;Synchronous=Off;UTF8Encoding=True;Version=3";
String sql = String.Empty;
sql = " select mail_title from mail_table";
//Functions.SqliteExcute.TaskFillListView(this.TaskList, sql ,conn);
SQLiteCommand cmd = new SQLiteCommand();
cmd.Connection = conn;
cmd.CommandText = sql;
conn.Open();
SQLiteDataReader read = cmd.ExecuteReader(); this.TaskList.Items.Clear(); while (read.Read())
{
ListViewItem items = new ListViewItem();
items.SubItems.Clear();
items.Text = read[0].ToString();
TaskList.Items.Add(items);
}
read.Close();
conn.Close(); }
应该是编码问题吧~!!!
items.Text = a;
那該怎麼轉呢,我加了轉為utf8,可雖還是亂碼。不行哦``