DataTable dt = new DataTable(); DataColumn dc = new DataColumn(); bool endOfTransaction = false; string csvData = File.ReadAllText(filePath); dc.ColumnName = "Number"; dt.Columns.Add(dc); foreach (string row in csvData.Split('\r')) { if (!string.IsNullOrEmpty(row) && row.Substring(0,3) != "STR") { if ((row.Substring(0, 3) == "END")) { Console.WriteLine("End of file"); endOfTransaction = true; } else { dt.Rows.Add(row); } } } SqlBulkCopy bc = new SqlBulkCopy(con,SqlBulkCopyOptions.TableLock, null); bc.DestinationTableName = "bulkAff_EmpNumbers"; bc.WriteToServer(dt); bc.Close(); cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = "[dbo].[chuck_doQAFF_C#]"; cmd.Parameters.Add(new SqlParameter("@DebugMode", 1)); cmd.CommandTimeout = 50000; SqlDataReader extractReader = cmd.ExecuteReader(); WriteToFile file = new WriteToFile(); file.parseResultSetToFile(extractReader);
Quote:if (row.row.Substring(0,3) != "END")
if (row.Substring(0,3) != "END")
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)