日期:2014-05-17 浏览次数:20504 次
if (openFileDialog1.ShowDialog() == DialogResult.OK) //OK表示按下了“打开”
{
string s = null;
DataTable table = new DataTable("auto");
DataRow row = null;
String[] split = null;
using (StreamReader sr = new StreamReader(openFileDialog1.FileName, UnicodeEncoding.GetEncoding("GB2312")))
{
s = sr.ReadLine();
split = s.Split(',');
int i = 0;
foreach (String colname in split)
{
//名为“ClampVal”的列已属于此 DataTable。
table.Columns.Add(colname, System.Type.GetType("System.String"));
i++;
}
int j = 0;
while (sr.Peek() > -1)
{
s = sr.ReadLine();
j = 0;
&