当我尝试读取.csv文件时。我可以看到一些空行,但我在.cvs文件中有数据。
但是当我打开并手动保存.csv文件然后我就能读取文件。
那些不起作用的行,我可以在一些单元格中看到一些双引号
你可以请别人告诉我这里发生了什么事吗?我的代码:
OleDBConn = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + strFilePath + ";Extended Properties=\"Text;HDR=YES;IMEX=1;FMT=Delimited\"");
OleDBConn.Open();
OleCmd.Connection = OleDBConn;
OleCmd.CommandText = @"SELECT [SFDC Unique Opportunity ID Ref] as [ID],[Trace Account Number] as [ACCOUNT_TRACE_ACCOUNT_NUMBER__C],[NAME],
[SFDC Unique Account ID ref] as [ACCOUNT_ID],[Account Name] as [ACCOUNT_NAME] ,[Contract Start Date] as [CONTRACT_START_DATE__C],
[Contract End Date] as [CONTRACT_END_DATE__C],[Pricing Method] as [PRICINGMETHOD__C],[Source] as [LEADSOURCE],
[Contracting Country] as [ACCOUNT_BILLINGCOUNTRY],[Region] as [ACCOUNT_REGION__C],[Currency] as [CURRENCYISOCODE],
[Closed Date/Decision Date] as [CLOSEDATE],[Owner] as [OWNER_ID],[Stage Name] as [STAGENAME],
[TRACE Opportunity GUID] as [TRACE_Opportunity_GUID],[Trace Master Deal] as [Trace_Master_Deal], [Current Stage] as Status,
[Vertical/Sales Owner] as Vertical_Sales_Owner,[Manual Probability] as Manual_Probability FROM " + AppiFormattedFilename; //strsplit[0] + ".csv";//"TRACEOPPORTUNITIES_2017-03-21.csv";
OleCmd.CommandType = CommandType.Text;
OleAdptr.SelectCommand = OleCmd;
OleAdptr.Fill(dtDumpData);