The borrowed solutions use simple text reading operations that are not suitable for CSV files, which contain commas or quotation marks within values, or which contain multiline values.
If you want to process CSV files yourself, then consider a designed class: TextFieldParser [https://learn.microsoft.com/en-us/dotnet/api/microsoft.visualbasic.fileio.textfieldparser?view=netframework-4.8]. It can be used in C# but requires a reference to Microsoft.VisualBasic assembly.
You can find many samples, for example:
using Microsoft.VisualBasic.FileIO;
. . .
using (var p = new TextFieldParser(@"C:\myfile.csv")
{
TextFieldType = FieldType.Delimited,
Delimiters = new[] { "," },
HasFieldsEnclosedInQuotes = true
})
{
while (!p.EndOfData)
{
// read and split one line of fields
string[] fields = p.ReadFields();
// each fields[i] is a value of a column
// . . .
}
}
It is not difficult to identify the first header row.
If you decide to build dynamic SQL, which is not always recommended, then replace each apostrophe (like “Brian D'Souza”) with two apostrophes using string.Replace function.
Try and debug it in a separate console application, in Visual Studio, before moving to SSIS.
But also check if SSIS contains other appropriate tasks.