Solved

Populate a drpdown with Current/ PreviousFinacial  Years

Posted on 2009-05-06
2
191 Views
Last Modified: 2012-05-06
Hi all,

I have to populate a dropdownlist based on a query.
Our company  have a financial year from Oct 2008- Sept 2009, next is Oct 2009 -Sept 2010.

In this query  "Select Distinct Year(ForecastDate) from OrderForecast order by Year(ForecastDate)"

I get 2008 and 2009. in this query i basically get the ,  the records that exist for a year , and i get the year from when the records were started inputting into  the database.

Now i need to populate drpdownlist with values like 2008-2009, for the users to select from.
Coming next financial year in Oct, there will be another set of values to be shown that is 2009-2010. This has to be automatically set in dropdown

I hope i have made myself clear.I tried my best to explain my problem.
Thanks for looking and help



0
Comment
Question by:SaraDob
2 Comments
 
LVL 12

Accepted Solution

by:
wht1986 earned 250 total points
Comment Utility
well you could do it in code or here is a sql statement you can use instead and bind to your dropdown

Select distinct convert(varchar, Year(ForecastDate)) + '-' + convert(varchar,YEAR(dateadd(year,1,ForecastDate))) as ForecastYear from OrderForecast order by ForecastYear
0
 
LVL 1

Author Comment

by:SaraDob
Comment Utility
wht1986,
Thanks for your reply and perfect answer.


0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

This article discusses the ASP.NET AJAX ModalPopupExtender control. In this article we will show how to use the ModalPopupExtender control, how to display/show/call the ASP.NET AJAX ModalPopupExtender control from javascript, how to show/display/cal…
ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

7 Experts available now in Live!

Get 1:1 Help Now