byte[] byData = new byte[100];
char[] charData = new char[1000];
string path = "F:\\小说\\新建文本文档 (2).txt";
read(path);
private static void read(string path)//分读取2,读取所有字符
{
StreamReader sr = new StreamReader(path, Encoding.Default);
string line="";
int judge = 0;
while ((line = sr.ReadLine()) != null)
{
if (line == "")
{
continue;
}
Console.WriteLine(line.ToString());
string sql = string.Format("insert into data values('{0}')", line);
int r = DBhelp.ExecuteNonQuery(sql);
if (r > 0)
{
judge++;
}
}
if (judge > 0)
{
System.Windows.Forms.MessageBox.Show("添加成功", "添加成功消息");
}
}
茅侃侃
千万里不及你
相关分类