首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > asp.net >

dropdownlist 选值有关问题

2012-02-11 
dropdownlist 选值问题1.我用dropdownlist绑定了一组数据,如下:asp:dropdownlistid fbtype runat se

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的数据我是从数据库中绑定的,就没有这个问题,请问这是为什么啊?


[解决办法]
调试一下,看是什么异常

热点排行