I am writing this code to run a sql server script using C #:
string sqlConnectionString = "Data Source=.;Initial Catalog=SERVERRAREPORT;Integrated Security=True";
FileInfo file = new FileInfo("d:\\behzadBULK.sql");
string script = file.OpenText().ReadToEnd();
SqlConnection conn = new SqlConnection(sqlConnectionString);
Microsoft.SqlServer.Server server = new Microsoft.SqlServer.Server(new ServerConnection(conn));
server.ConnectionContext.ExecuteNonQuery(script);
and in behzadBULK.sqlI will write this code:
BULK INSERT TEMPO
FROM 'd:\3.csv'
WITH(
FIELDTERMINATOR = ',',
ROWTERMINATOR = '\n',
CODEPAGE = '1256'
);
in "Bulk Insert", "From the parameter set with the file name, this parameter is static, but I want the application to look at the browser file in C # and select the file and set the file name for the mass paste from the parameter.
my plan is this:

source
share