MySqlCommand command = connection.CreateCommand();
command.CommandText = string.Format("SELECT * FROM characters WHERE account_id = '{0}'", this.ID);
MySqlDataReader reader = command.ExecuteReader();
while (reader.Read()) { ... }
我在最後一行說「讀取器關閉時讀取無效嘗試」時出現錯誤。 現在,如果我之前另起一行,如:矛盾的MySqlReader錯誤
MySqlCommand command = connection.CreateCommand();
command.CommandText = string.Format("SELECT * FROM characters WHERE account_id = '{0}'", this.ID);
MySqlDataReader reader = command.ExecuteReader();
reader = command.ExecuteReader(); // Here.
while (reader.Read()) { ... }
我會在新線的錯誤說「已經有與此連接必須先關閉相關聯的打開的DataReader。」
好吧,我不想在這裏挑剔,但我的讀者是否打開或關閉?
您的連接是否打開? – dochoffiday 2010-04-02 01:37:18