[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Populate a drpdown with Current/ PreviousFinacial  Years

Posted on 2009-05-06
2
Medium Priority
?
201 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 1000 total points
ID: 24321436
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
ID: 24325393
wht1986,
Thanks for your reply and perfect answer.


0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Today is the age of broadband.  More and more people are going this route determined to experience the web and it’s multitude of services as quickly and painlessly as possible. Coupled with the move to broadband, people are experiencing the web via …
IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
Suggested Courses

873 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