将数据写入到CSV文件中--出现“科学计数法”问题

  1. 在数据后面加上"/t" 或者加上/r 进行转义

  2. Ends.Write(retReader["Statis_dt"].ToString() + ","); Ends.Write(retReader["BranchCode"].ToString() + ","); Ends.Write(retReader["OrganCode"].ToString() + ","); Ends.Write(retReader["Iou_No"].ToString() + "/t,"); Ends.Write(retReader["Contract_No"].ToString() + "/t,"); Ends.Write(retReader["Repay_Term_No"].ToString() + ","); Ends.Write(retReader["Plan_Repay_dt"].ToString() + ","); Ends.Write(retReader["Act_Repay_dt"].ToString() + ","); Ends.Write(retReader["Repay_Capital"].ToString() + ","); Ends.Write(retReader["Loan_Bal"].ToString() + ","); Ends.Write(retReader["Next_Term_Repay_Capital"].ToString() + ","); Ends.Write(retReader["Repay_Status"].ToString() + ","); Ends.Write(retReader["InsertTime"].ToString() + ",");   

  3.  private void WriteDataLines(StreamWriter streamWriter)

  4.         {

  5.             foreach (DataRow dataRow in _dataTable.Rows)

  6.             {

  7.                 foreach (DataColumn dataColumn in _dataTable.Columns)

  8.                 {

  9.                     WriteValue(streamWriter, dataRow[dataColumn.ColumnName].ToString()+"\r");

  10.                 }

  11.                 streamWriter.WriteLine();

  12.             }

  13.         }

  14. Ends.Write(Ends.NewLine);  


你可能感兴趣的:(将数据写入到CSV文件中--出现“科学计数法”问题)