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
Solved

Populate a drpdown with Current/ PreviousFinacial  Years

Posted on 2009-05-06
2
194 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
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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Looking for a solution or even half a solution for custom web portal 5 53
Save ms data to server side. 19 55
hbo knew my windows software 4 60
Why use this lambda? 12 26
Sometimes in DotNetNuke module development you want to swap controls within the same module definition.  In doing this DNN (somewhat annoyingly) swaps the Skin and Container definitions to the default admin selections.  To get around this you need t…
In .NET 2.0, Microsoft introduced the Web Site.  This was the default way to create a web Project in Visual Studio 2005.  In Visual Studio 2008, the Web Application has been restored as the default web Project in Visual Studio/.NET 3.x The Web Si…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

791 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