本文介绍了阅读Word文档的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
openFileDialog1.ShowDialog();
textBox1.Text = openFileDialog1.FileName;
string fname = openFileDialog1.FileName;
TextReader trs = new StreamReader(@fname);
String s=trs.ReadLine();
s=s.ToString();
while (s != null)
{
String x = "";
for (int i = 0; i < s.Length; i++)
{
if(s[i]!=''.'')//add the required special characters along withit
x += s[i];
}
s = x;
s = trs.ReadLine();
conn.Open();
SqlCommand cmd = new SqlCommand("insert into C_word (Words,Category) values(''" + s +"'',''" + comboBox1.SelectedText + "'')",conn);
cmd.ExecuteNonQuery();
conn.Close();
}
使用此代码时出现此错误:
字符串或二进制数据将被截断.
该声明已终止.
请,有人可以清除它吗?
While using this code I got this error:
String or binary data would be truncated.
The statement has been terminated.
Please, can anyone clear it?
推荐答案
这篇关于阅读Word文档的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!