Friday, April 04, 2008

Extracting a month from String - C#

How do extract the month from the user entered string?

DateTime dt=Request.Form["DropDownList1"];
string spdate=dt.Month;

Then simply use this string on your query like to see the result on monthly based
Select *from Sales where Month(salesdate)='"+spdate+"' ;