Generate sql script using c# code

class Program { static void Main(string[] args) { string dbConnectionString = “Server=./sqlexpress;Database=mydata;User ID=sa;Password=test@111;Trusted_Connection=False;Encrypt=True;Connection Timeout=30;”; string databaseName = “mydata”; ScriptDatabase(dbConnectionString, databaseName); } public static string ScriptDatabase(string dbConnectionString, string databaseName) { SqlConnection conn = new SqlConnection(dbConnectionString); ServerConnection serverConn = new ServerConnection(conn); var server = new Server(serverConn); var database = server.Databases[databaseName]; var scripter = new Scripter(server); /* With… Read More Generate sql script using c# code