private void ButtonCreatePlayer_Click(object sender, System.EventArgs e) { if (comboBoxSelectPlayer.Text.Length == 0) { MessageBox.Show("玩家名称不能为空"); return; } PlayerBean player = new PlayerBean { Name = comboBoxSelectPlayer.Text }; int result = playerDAO.Insert(player); if (result > 0) { MessageBox.Show("创建成功"); comboBoxSelectPlayer.Items.Add(player); comboBoxSelectPlayer.SelectedItem = player; } else { MessageBox.Show("创建失败"); } }