Cognos 中日期提示中具有动态月份和年份的下拉列表框

发布于 2024-07-09 04:29:24 字数 168 浏览 5 评论 0原文

我想将当前月份和前两个月添加到提示中,供用户选择。

例如,如果本月是 2008 Novddlbox 应显示以下内容:

112008
102008
092008

我该如何执行此操作?

I want to add the current month, and the previous two months to a prompt, for a user to select.

e.g. if this month is 2008 Nov, ddlbox should show the following:

112008
102008
092008

How can I do this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

把时间冻结 2024-07-16 04:29:24
<asp:DropDownList ID="DropDownList1" runat="server">
</asp:DropDownList>

for (int i = 0; i < 3; i++)
{
    ListItem item = new ListItem(string.Format("{0: MM/yyyy}", DateTime.Now.AddMonths(-i)));
    DropDownList1.Items.Add(item);
}

尝试这个 :)

<asp:DropDownList ID="DropDownList1" runat="server">
</asp:DropDownList>

for (int i = 0; i < 3; i++)
{
    ListItem item = new ListItem(string.Format("{0: MM/yyyy}", DateTime.Now.AddMonths(-i)));
    DropDownList1.Items.Add(item);
}

Try this :)

征﹌骨岁月お 2024-07-16 04:29:24

您还可以使用 SQL 创建查询主题,如下 Oracle 示例所示:

SELECT to_char(add_months(SYSDATE, -1 * LEVEL + 1), 'MMYYYY') AS mon
FROM   dual
CONNECT BY rownum < 4

You could also create a query subject with SQL like this Oracle example:

SELECT to_char(add_months(SYSDATE, -1 * LEVEL + 1), 'MMYYYY') AS mon
FROM   dual
CONNECT BY rownum < 4
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文