Q:

SQL Server multiple rows insert from .sql file in C#

Ok, so suppose I have a .sql file (e.g., data.sql) with a couple thousand insert commands, like this:
...
INSERT INTO some_table VALUES ('person_name_1', 31, 'CA');
INSERT INTO some_table VALUES ('person_name_2', 29, 'NC');
INSERT INTO some_table VALUES ('person_name_3', 18, 'NY');
INSERT INTO some_table VALUES ('person_name_4', 21, 'IL');
INSERT INTO some_table VALUES ('person_name_5', 25, 'FL');
...

I wanted to know the best way to insert this data into a SQL Server 2012 database from C# code, and just as additional info, this is something that will be done once daily, but manually, from a web interface.
Right now, what I have is: I parse the .sql file and build this really big INSERT, so I end up with a StringBuilder (sb) that has
INSERT INTO some_table VALUES
    ('person_name_1', 31, 'CA'),
    ('person_name_2', 29, 'NC'),
    ('person_name_3', 18, 'NY'),
    ('person_name_4', 21, 'IL'),
    ('person_name_5', 25, 'FL'),
    ...

And then I run
using (var cmd = new SqlCommand { Connection = conn })
{
    cmd.CommandType = CommandType.Text;
    cmd.CommandText = sb.ToString().Remove(sb.Length - 1);
    cmd.ExecuteNonQuery();
}

Any thoughts on a better way to do this?

A:

you can try SQL Server Management Objects (SMO)
using System.Data.SqlClient;
using System.IO;
using Microsoft.SqlServer.Management.Common;
using Microsoft.SqlServer.Management.Smo;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            string sqlConnectionString = "...";
            string script =File.ReadAllText("data.sql");
            SqlConnection conn = new SqlConnection(sqlConnectionString);
            Server server = new Server(new ServerConnection(conn));
            server.ConnectionContext.ExecuteNonQuery(script);
        }
    }
}

If you need to read sql string from a web page 
var webClient = new WebClient();
string script = webClient.DownloadString("your_file_path_url");

