Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/71.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 阅读器因为某种原因关闭了?_C#_Mysql - Fatal编程技术网

C# 阅读器因为某种原因关闭了?

C# 阅读器因为某种原因关闭了?,c#,mysql,C#,Mysql,修复Mysql引用的版本。我使用的数据太旧了,我更新到了新版本,它修复了它。无论如何,谢谢你 我的SQL连接字符串是: server=localhost; database=information_schema; uid=root; password=; convertzerodatetime=yes 我试图执行的查询是: "SELECT * FROM COLUMNS WHERE TABLE_SCHEMA = 'serenity'" 但是,我使用以下代码: using (MySqlDataR

修复Mysql引用的版本。我使用的数据太旧了,我更新到了新版本,它修复了它。无论如何,谢谢你

我的SQL连接字符串是:

server=localhost; database=information_schema; uid=root; password=; convertzerodatetime=yes
我试图执行的查询是:

"SELECT * FROM COLUMNS WHERE TABLE_SCHEMA = 'serenity'"
但是,我使用以下代码:

using (MySqlDataReader reader = MySqlHelper.ExecuteReader(Database.ConnectionString, query))
            {
                if (!reader.HasRows)
                {
                    Logger.WriteLog(Logger.LogTypes.Error, "Unable to populate meta.");
                    return;
                }

                while (reader.Read())
                {
                    Dictionary<string, object> dictionary = new Dictionary<string, object>();

                    for (int i = 0; i < reader.FieldCount; i++)
                    {
                        dictionary.Add(reader.GetName(i), reader.GetValue(i));
                    }

                    this.Values.Add(new Datum(this.Table, dictionary));
                }
            }

你能给我们看一下异常和它在哪一行吗?你在使用多个线程吗..它们可能同时访问该方法..还可以给我们看确切的error@Anirudh我将op编辑为它抛出的错误,不,我没有使用多个线程。@user2979962:post
MySqlHelper.ExecuteReader
code,请,以及使用(MySqlDataReader=MySqlHelper.ExecuteReader…@Dennis)的
的完整代码块
Invalid attempt to Read when reader is closed. - MySqlException on the while loop.