我不明白这个代码片段。当我尝试另一个 excel 文件时,它无法正确编译。为什么程序员使用 F,它指的是列还是行?
string strProvider;
if (dbFilePath.LastIndexOf("xlsx") > -1)
strProvider = @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + dbFilePath + @";Extended Properties=""Excel 12.0 Xml;HDR=YES"";";
else
strProvider = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=""" + dbFilePath + @""";Persist Security Info=False;Extended Properties=""Excel 8.0;""";
string strQuery = "SELECT " +
"F9 AS EmpNbr, " +
"F10 AS ACCTSTATUS, " +
"F1 AS PROJECTEDAGE, " +
"F14 AS UPDBALDUE, " +
"F15 AS AMTCURRENT, " +
"F16 AS AMT30DAY, " +
"F17 AS AMT60DAY, " +
"F18 AS AMT90DAY, " +
"F19 AS AMT120DAY, " +
"F20 AS AMT150DAY, " +
"F21 AS AMT180DAY " +
"FROM [Sheet1$A8:V] " +
"WHERE F9 IS NOT NULL AND " +
"(F17 > 0 OR F18 > 0 OR F19 > 0 OR F20 > 0 OR F21 > 0) " +
" AND Trim(F10) <> 'RETURN MAIL/LEFT COMPANY' " +
" AND Trim(Left(F1,3)) IN ('60','90','120','150','180') " +
"ORDER BY F9 ";