首页 > 解决方案 > c# 显示 MySQLScript 类的警告

问题描述

我正在学习使用 MySqlScript 类,并且我认为我已经知道如何从文件中执行 MySQL 脚本,并且还知道刚刚执行了什么语句(使用 StatementExecuted 事件)。但是 MySQL 警告呢?有没有办法在脚本中显示结果或每个语句的警告?

我想显示带有相应警告/受影响行的 SQL 语句

MySqlScript script = new MySqlScript(myConexion, File.ReadAllText(openFileDialog1.FileName));
script.StatementExecuted += Script_StatementExecuted;
script.Execute();


private void Script_StatementExecuted(object sender, MySqlScriptEventArgs args)
{
    MessageBox.Show(args.StatementText); // this is only a test, this will be stored in some other place not displayed as a message;
}

标签: c#warningssql-scripts

解决方案


推荐阅读