(cmbSelect)为自定义的下拉框name;cmbSelect.SelectedIndex表示下拉框内集合的序号,由0开始计起。

例如:

 1 int i = cmbSelect.SelectedIndex;
 2                 switch (i)
 3                 {
 4                     case 0:
 5                         sql1 = "select * from Student where sno='" + texSelect.Text.Trim() + "'";
 6                         break;
 7                     case 1:
 8                         sql1 = "select * from Student where sname like   '%" + texSelect.Text.Trim() + "'";
 9                         break;
10                     case 2:
11                         sql1 = "select * from Student where sex like   '%" + texSelect.Text.Trim() + "'";
12                         break;

   自己真的是好菜啊,呃啊啊啊啊。。。

posted on 2020-06-15 21:12  NODE_L  阅读(180)  评论(0编辑  收藏  举报