声明下拉选定数据asp.net vb

一起
<td style="width: 10%;">
                    <asp:DropDownList runat="server" ID="ddlMonth" AutoPostBack="true">
                        <asp:ListItem>Month</asp:ListItem>
                        <asp:ListItem>January</asp:ListItem>
                        <asp:ListItem>February</asp:ListItem>
                        <asp:ListItem>March</asp:ListItem>
                        <asp:ListItem>April</asp:ListItem>
                        <asp:ListItem>May</asp:ListItem>
                        <asp:ListItem>June</asp:ListItem>
                        <asp:ListItem>July</asp:ListItem>
                        <asp:ListItem>August</asp:ListItem>
                        <asp:ListItem>September</asp:ListItem>
                        <asp:ListItem>October</asp:ListItem>
                        <asp:ListItem>November</asp:ListItem>
                        <asp:ListItem>December</asp:ListItem>
                    </asp:DropDownList>
                </td>

其实我想让下拉列表选择的项目回到 vb 页面。我如何声明所选项目?

那之后怎么插入到sql语句中呢?

  lsCmd = "SELECT * FROM"
            lsCmd &= " (SELECT DISTINCT code, upload, DATEPART(dd, [date]) as Date"
            lsCmd &= " FROM edrsDB..tbl_users"
            lsCmd &= " left join edrsDB..edrs_upload"
            lsCmd &= " ON edrs_upload.userid = tbl_users.userID"
            lsCmd &= " WHERE DATEPART(MM, [date])= " & SQLQUOTE(Trim(ddlMonth.SelectedIndex))
            lsCmd &= " And DATEPART(YYYY, [date])= " & SQLQUOTE(Trim(ddlYear.SelectedIndex))
            lsCmd &= " And date IS NOT NULL) AS monthlyRpt"
            lsCmd &= " PIVOT (MAX(upload)"
维尤纳夫·瓦斯蒂夫奇

你可以在后面的代码中做到这一点:

DropDownList1.SelectedItem.Text = "January"

或者

//按索引选择

DropDownList1.SelectedIndex = 5;

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章