Solved

Populate a drpdown with Current/ PreviousFinacial  Years

Posted on 2009-05-06
2
196 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 12

Accepted Solution

by:
wht1986 earned 250 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

One of the pain points with developing AJAX, JavaScript, JQuery, and other client-side behaviors is that JavaScript doesn’t allow for cross domain request for pulling content. For example, JavaScript code on www.johnchapman.name could not pull conte…
Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…

740 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