我想將SQLite的編碼設置爲UTF-16。我怎麼能從代碼做到這一點? prefferably在vb.net,但我能夠到C#轉換爲vb.net在.net中設置sqlite編譯指令爲「UTF-16」
我使用數據庫輔助類從這個網址,我轉換成vb.net代碼: http://tech.just4sharing.com/Pages/ASP/How-to-use-SQLite-database-in-Visual-Studio.aspx
我想這VB .net代碼:
dbConnection = "Data Source=database.s3db;PRAGMA encoding = ""UTF-16"";"
但是這個diddent工作。
後@Dai後我在SQLiteDatabase輔助類的構造函數嘗試這樣做,刪除舊的數據庫
vb.net代碼:
dbConnection = "Data Source=database.s3db;"
Dim cnn As New SQLite.SQLiteConnection(dbConnection)
cnn.Open()
Using cmd As SQLiteCommand = cnn.CreateCommand()
cmd.CommandText = "PRAGMA encoding = ""UTF-16"";"
cmd.ExecuteNonQuery()
End Using
cnn.Close()
C#代碼:
SQLiteConnection c = new SQLiteConnection(dbConnectioN)
c.Open()
using(SQLiteCommand cmd = c.CreateCommand()) {
cmd.CommandText = "PRAGMA encoding = \"UTF-16\"";
cmd.ExecuteNonQuery();
}
c.Close()
但這也做了工作,管理員(SQLite的IDE)仍然難過它是UTF-8
謝謝,我更新了這個問題,我希望你能看看它? – user2653652 2015-04-01 18:39:06