string[] courseId = new string[20];//储存课程号 private void showCourse(string tea_id) { courseBll = new CourseBll(); SqlDataReader sda = courseBll.showCourse(tea_id); int i = 0; while (sda.Read()) { c_course.Items.Add(sda["cou_name"]); courseId[i] = sda["cou_id"].ToString(); i++; } if (c_course.Items.Count == 0) { c_course.Text = "您还没有所教的课程"; } }