1.把cvs读取到dt中
/// <summary>
/// 把csv读到dt中
/// </summary>
/// <param name="file">csv文件路径</param>
/// <returns>dt</returns>
public static DataTable ReadDataFromCsv(string file)
{
DataTable dt = null;
if (File.Exists(file))
{
#region 如果文件存在
dt = new DataTable();
FileStream fs = new FileStream(file, FileMode.OpenOrCreate, FileAccess.Read);
StreamReader sr = new StreamReader(fs,Encoding.Default);
string head = sr.ReadLine();
string[] headNames = head.Split(',');
for (int i = 0; i < headNames.Length; i++)
{
dt.Columns.Add(headNames[i], typeof(string));
}
wh