读书人

dropdownlist 选值有关问题

发布时间: 2012-02-11 09:51:34 作者: rapoo

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


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

读书人网 >asp.net

热点推荐