注册 登录
编程论坛 ASP.NET技术论坛

dropdownlist 选值问题

scindy 发布于 2007-08-04 19:19, 540 次点击

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

1 回复
#2
scindy2007-08-04 19:21

刚才问了一个类似的问题,不过说得不是很清楚,再重新问一下,版主不要删贴啊!谢谢!

望各位帮忙解决一下!!!

1