字符串数组保持返回0 / null

时间:2015-01-27 04:04:19

标签: c#

我在使用数组时遇到问题并传入string = 0 ..虽然excel表数据得到了值,但它仍保持0。好心劝告。

下面是代码sheetnameList = 0

string[] sheetnameList = GetExcelSheetName(@"" + 
    var_SourceFilePath + "MBF_Cancel_Temp.xlsx" + "");

foreach (string sheetName in sheetnameList)
{
    if (sheetName.Contains("$"))
    {
        InsertLogFile("AMB SP15 Cancellation: Processing SheetName " + sheetName);

        DeleteTable();

        DataTable sheetTable = loadSingleSheet(@"" + var_SourceFilePath + 
            "MBF_Cancel_Temp.xlsx" + "", sheetName);

        InsertDBMaster();
    }
}

1 个答案:

答案 0 :(得分:0)

预感,试试这个:

string[] sheetnameList = GetExcelSheetName(var_SourceFilePath + @"\\" + "MBF_Cancel_Temp.xlsx");

甚至更好:

var path = Path.Combine(var_SourceFilePath, "MBF_Cancel_Temp.xlsx");
var sheetnameList = GetExcelSheetName(path);