MySqlConnection addh = new MySqlConnection(System.Configuration.ConfigurationManager.AppSettings["ConnectionString"]); addh.Open(); MySqlCommand myCommand = new MySqlCommand(myqry, addh);
MySqlDataReader myDataReader; myDataReader = myCommand.ExecuteReader(); if (myDataReader.HasRows) { while (myDataReader.Read()) { foreach(string ede in array) { MySqlCommand cmd = new MySqlCommand(amenity, addh); int insert_result = cmd.ExecuteNonQuery(); } } myDataReader.Close(); addh.Close();
C# mySQL There is already an open DataReader associated with this Connection which must be closed first
foreach
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)