http://okwave.jp/qa/q5096547.html
連続する改行が1つにまとめられる仕様になっている。
OLEDBを利用したCSV取り込みをすればこの問題は起きない。
public static DataTable CsvToTbl(string sPathFileName, bool bHead)
{
try
{
string[] sSpl = sPathFileName.Split('\\');
string sDir = sPathFileName.Substring(0, sPathFileName.Length - sSpl[sSpl.Length - 1].Length);
string sFileName = sSpl[sSpl.Length - 1];
string sHead = "";
if (bHead)
{
sHead = "Yes";
}
else
{
sHead = "No";
}
//接続文字列
string sCon = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + sDir + ";Extended Properties=\"text;HDR=" + sHead + ";FMT=Delimited\"";
System.Data.OleDb.OleDbConnection oCon = new System.Data.OleDb.OleDbConnection(sCon);
string sSql = "SELECT * FROM [" + sFileName + "]";
System.Data.OleDb.OleDbDataAdapter oDs = new System.Data.OleDb.OleDbDataAdapter(sSql, oCon);
//DataTableに格納する
DataTable oTbl = new DataTable();
oDs.Fill(oTbl);
return oTbl;
}
catch
{
return new DataTable(); // 空データテーブル
}
}