MySqlCommand Sql1 = new MySqlCommand("SELECT * FROM animal WHERE idAnimal ='" + label1.Text + "'", Connection);MySqlDataReader dr1;dr1 = Sql1.ExecuteReader();while (dr1.Read()){ String idAnimal = dr1["idAnimal"].ToString(); MySqlCommand Sql2 = new MySqlCommand("SELECT * FROM town WHERE id ='" + idAnimal + "'", Connectio); MySqlDataReader dr2; dr2 = Sql2.ExecuteReader(); while (dr2.Read()) { dataGridView1.Rows.Add(dr2["number"], dr2["name"]); } dr2.Close();}dr1.Close();Connection.Close();
- 3 回答
- 0 关注
- 346 浏览
添加回答
举报
0/150
提交
取消