Z
zh_haoer
Unregistered / Unconfirmed
GUEST, unregistred user!
大 虾们!读取数据库中二进制文件并且其内容按双字节字节拼成汉字显示出来,vc的 程序是这样编,在delphi编程中如何实现?(关键是手工用数组拼写出来的 )(100分)<br />private void UpdatePreview( int index)
{
OleDbConnection conn = new OleDbConnection(m_conn_str);
string telegraph_id = MainDataView.Rows[index].Cells[0].Value.ToString();
string command = "select 电报数据 from TelegraphData where 电报代码 ='" + telegraph_id + "'";
OleDbDataAdapter da = new OleDbDataAdapter(command, conn);
DataSet ds = new DataSet();
da.Fill(ds);
conn.Close();
object o = ds.Tables[0].Rows[0].ItemArray[0];
byte[] bs = (byte[])o;
List<char> cs = new List<char>();
for (int i = 0; i < bs.Length; i++) {
if (i % 2 == 0) {
char c = (char)(bs + bs[i + 1] * 256);
cs.Add(c);
}
}
//
PreViewTextBox.Text = new string(cs.ToArray());
{
OleDbConnection conn = new OleDbConnection(m_conn_str);
string telegraph_id = MainDataView.Rows[index].Cells[0].Value.ToString();
string command = "select 电报数据 from TelegraphData where 电报代码 ='" + telegraph_id + "'";
OleDbDataAdapter da = new OleDbDataAdapter(command, conn);
DataSet ds = new DataSet();
da.Fill(ds);
conn.Close();
object o = ds.Tables[0].Rows[0].ItemArray[0];
byte[] bs = (byte[])o;
List<char> cs = new List<char>();
for (int i = 0; i < bs.Length; i++) {
if (i % 2 == 0) {
char c = (char)(bs + bs[i + 1] * 256);
cs.Add(c);
}
}
//
PreViewTextBox.Text = new string(cs.ToArray());