using System.IO;using System.Data.SqlClient;using Microsoft.SqlServer.Management.Common;using Microsoft.SqlServer.Management.Smo;
string sqlConnectionString = txtConstring.Text; //connection stringFileInfo file = new FileInfo(path + "Procedure_fn.sql"); //*.sql file pathstring script = file.OpenText().ReadToEnd();SqlConnection conn = new SqlConnection(sqlConnectionString);Server server = new Server(new ServerConnection(conn));server.ConnectionContext.ExecuteNonQuery(script);
You need to be a premium member to use this feature. To access it, you'll have to upgrade your membership.
Become a sharper developer and jumpstart your career.
$0
$
. 00
monthly
For Basic members:
$20
For Premium members:
$45
For Elite members: