Hi,
I want to save a variable in sql table in place of date.
Example:
if date is in between January to June and my date is: 8 May 2014 then var = value1
if date is in between July to December and my date is 20 September 2014 then var = value2
if question is not clear plz let me now I will more explain..
please help.

lv prasad17 reputationPosted Aug 23, 2014, 11:46 AM EDT
The below code will help you..
int value=0;
//Here you are taking ur date into some datetime variable
DateTime dt = "Give your date";
//Fetching only month from ur given date
int month = dt.Month;
//then comapring and assign the value;
if (month > 7)
{
value=1;
}
else
{
value=2;
}
rachayita jaiswal32 reputationPosted Aug 23, 2014, 12:30 PM EDT
thanks for reply...
by mistake I mentioned jan to june and july to dec but....
I want month between april to September and October to april
plz help
rachayita jaiswal32 reputationPosted Aug 23, 2014, 12:36 PM EDT
rachayita jaiswal32 reputationPosted Aug 23, 2014, 12:46 PM EDT
I am inserting getdate() in c# code for one column like-
insert into table (date) values (getdate());
but inplace of getdate() I want to insert that "month" variable......
plz help
lv prasad17 reputationPosted Aug 23, 2014, 1:16 PM EDT