请帮我选择组合框列表表格数据库
void fillCombo2()
{
try
{
cc.con = new SqlConnection(cs.DBConn);
cc.con.Open();
cc.cmd = new SqlCommand("Select kod_jawatan from jawatan", cc.con);
cc.rdr = cc.cmd.ExecuteReader(CommandBehavior.CloseConnection);
while (cc.rdr.Read() == true)
{
int kID = cc.rdr.GetInt32(0);
comboBox1.Items.Add(kID);
//comboBox1_SelectedIndexChanged will change the index to textbox
}
cc.con.Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
但我收到以下异常:指定演员无效。