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 prasadPosted Aug 23, 2014, 3:46 PM
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;
}
lv prasadPosted Aug 23, 2014, 5:16 PM
rachayita jaiswalPosted Aug 23, 2014, 4:46 PM
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
rachayita jaiswalPosted Aug 23, 2014, 4:36 PM
rachayita jaiswalPosted Aug 23, 2014, 4:30 PM
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