C# 阅读器因为某种原因关闭了?
修复Mysql引用的版本。我使用的数据太旧了,我更新到了新版本,它修复了它。无论如何,谢谢你 我的SQL连接字符串是: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
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.