日期:2014-05-18  浏览次数:20418 次

dropdownlist 选值问题
1.我用   dropdownlist绑定了一组数据,如下:

<asp:dropdownlist   id= "fbtype "   runat= "server "   Width= "100px ">
          <asp:ListItem   Value= "sale "> 出售 </asp:ListItem>
          <asp:ListItem   Value= "buy "> 购买 </asp:ListItem>
          <asp:ListItem   Value= "hire "> 出租 </asp:ListItem>
          <asp:ListItem   Value= "hired "> 求租 </asp:ListItem>
</asp:dropdownlist>

2.定义变量c来获取相应的值

Dim   c   As   String
If   fbtype.SelectedValue   =   "sale "   Then
c   =   "S "
ElseIf   fbtype.SelectedValue   =   "hire "   Then
                c   =   "H "
End   If

3.把变量c赋值给数据库字段Hstyle

insert   into   tblhouse(Hstyle)   values( ' "   &   c   &   " ')

4.问题出现了,当我选   出售   时,能正常插入。选别的任何一个都不能插入。
另一个dropdownlist的数据我是从数据库中绑定的,就没有这个问题,请问这是为什么啊?


------解决方案--------------------
调试一下,看是什么异常