Errors:
There is already an open DataReader associated with this Connection which must be closed first MySql.Data.MySqlClient.MySqlException (0x80004005): There is already an open DataReader associated with this Connection which must be closed first.
string query = "SELECT * FROM worldbans WHERE bannedPlayerID=?accID AND worldName=?thisWorldName;";
MySqlCommand hadi = new MySqlCommand(query, dbConn);
hadi.CommandTimeout = 86400;
hadi.Parameters.AddWithValue("?accID", (currentPeer.Data as PlayerInfo).accountID);
hadi.Parameters.AddWithValue("?thisWorldName", (peer.Data as PlayerInfo).currentWorld);
MySqlDataReader reader = hadi.ExecuteReader();
{
sendconsolemsg(peer, "`4WARNING: `8This player is already banned in this world `2(`7/uba`2) `8 to unban.");
reader.Close();
}
else
{
reader.Close();
}
This is one of my MySQL-related
codes, I have a lot of them in my code. These errors start appearing 15-30 minutes after I start my server where the players are playing. I can probably guess why these errors appear: Data is being read from the database somewhere. In the process, one more occurs before the previous one is completed. So what should I do to fix it? I'm using in each MySQL
request the same connection (dbConn variable).
User contributions licensed under CC BY-SA 3.0