日期:2014-05-17 浏览次数:20941 次
DataTable dt = new DataTable();
dt.Columns.AddRange(new DataColumn[] {
new DataColumn("d1",typeof(string)),
new DataColumn("d2",typeof(string)),
new DataColumn("d3",typeof(string))
});
DataRow dr = null;
string num = string.Empty;
StreamReader sr = new StreamReader("test.txt");
while (sr.Peek() > -1)
{
dr = dt.NewRow();
string line = sr.ReadLine();
if (line.Contains(","))
{
string[] array = line.Split(',');