2017-06-20 60 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; 

    }