/// <summary> /// 执行数据库脚本。 /// </summary> /// <param name="connection">数据库连接对象</param> /// <param name="script">脚本名称</param> private void ExecuteScript(DbConnection connection, string script) { this.SendMessage($"<span style=\"margin-left:25px;\">开始导入{script}脚本...</span>"); var command = connection.CreateCommand(); var commandTexts = this.ResolveScripts(script); connection.SafeOpen(); foreach (var commandText in commandTexts) { command.CommandText = commandText; command.ExecuteNonQuery(); } this.SendMessage($"<span style=\"margin-left:25px;\">{script}脚本导入成功!</span>"); }