2017-06-20 75 views
0

我有誰阿拉伯文文本存放在varchar
我用這個代碼,但是當嘗試讀取值問號出現,而不是性格
如何從varchar列讀取阿拉伯文字?

SQLiteConnection con = new SQLiteConnection("Data Source=Quran.sqlite;Version=3;"); 
SQLiteCommand cmd = new SQLiteCommand("SELECT Qtxt FROM tblQTxt'", con); 
con.Open(); 
SQLiteDataReader dr = cmd.ExecuteReader(); 

dr.Read(); 
textBox1.Text = dr["Qtxt"].ToString(); 

dr.Close(); 
con.Close(); 

我用「DB瀏覽器SQLite的」來回SQLite數據庫打開數據庫
當試圖查看現場爲二進制模式,然後導出爲文本我會看到真實性格

DB Browser for SQLite

如何才能真正閱讀這個領域?

+0

SQLite本身不會更改字符串;這可能是一個數據庫瀏覽器錯誤。像SQLite Manager這樣的其他工具可以工作嗎? –

+0

@CL。在此數據庫字符串中保存爲二進制,並且必須轉換爲文本 – Tavakkoli

+0

@CL。這個鏈接下載數據庫:https://ufile.io/qa4ts – Tavakkoli

回答

0
SQLiteConnection con = new SQLiteConnection("Data Source=Quran.sqlite;Version=3;"); 
    SQLiteCommand cmd = new SQLiteCommand("SELECT Qtxt2 FROM tblQTxt where Sore='1' and Aye='1'", con); 

    SQLiteDataAdapter dAdapter = new SQLiteDataAdapter(cmd); 
    DataSet dSet = new DataSet(); 
    dAdapter.Fill(dSet); 

    if (dSet.Tables[0].Rows.Count == 1) 
    { 

     Byte[] data = new Byte[0]; 
     data = (Byte[])(dSet.Tables[0].Rows[0]["Qtxt2"]); 

     MemoryStream ms = new MemoryStream(); 
     ms.Write(data, 0, data.Length); 

     ms.Position = 0; 
     StreamReader reader = new StreamReader(ms,Encoding.GetEncoding(1256)); 
     string text = reader.ReadToEnd(); 
     textBox1.Text = text; 

    }