If you will always have a single header line that you want to skip, just read that row without processing it by wrapping your existing while() inside of an if().
if ((input = sr.ReadLine()) != null)
{
// already read line #1 (i.e. header line),
// now start processing data, if any lines exist
while ((input = sr.ReadLine()) != null)
{
...
}
}
General Notes:
- I hope the "sa" account in the connection string is just an example. If not, use another account. Using "sa" is a bad idea.
- Depending on the size of the input file, this could be rather inefficient with memory since it needs to read the entire file into the DataTable first. You would be better off creating a TVP (table-valued parameter) in SQL Server, using it as an input parameter to a proc that does this insert by reading from the TVP, and updating this code so that as each line of the file is read and split on tabs, each line is sent to SQL Server so you never have more than 1 row of the input file in memory.