How would you insert records into a SQL Server 2005 table from a List using C# with VS2010?

How would you modify the following method to insert each record into a SQL Server 2005 table titled tbl_SMR_Bank_Credits_A that is comprised of the fields f1 through f14 that are
of type nvarchar(255)?

For ex:

f1 =   convertedRow[0]
f2 =   convertedRow[1]
f14 = convertedRow[13]

protected void UploadToDB(string fileName)
            FileInfo info = new FileInfo(fileName);
            string tableName = info.Name;

            List<string> rows = new List<string>();

            StreamReader reader = new StreamReader(fileName);
            string record = reader.ReadLine();
            while (record != null)
                record = reader.ReadLine();

            List<string[]> rowObjects = new List<string[]>();

            int maxColsCount = 0;
            foreach (string s in rows)
                string[] convertedRow = s.Split(new char[] { ',' });
                if (convertedRow.Length > maxColsCount)
                    maxColsCount = convertedRow.Length;
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Kyle AbrahamsSenior .Net DeveloperCommented:
I would create a stored proc the does the insert,

create a SqlConnection
loop over the list

create a SqlCommand
add each field as a parameter to the command
Set the Command To the connection
open the connection
close the connection
next record.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.