Click here to Skip to main content
15,885,757 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
i am using ajax calendar control and textbox when i select date from calendar it appears in the textbox and then i insert this value in database,my query is i want insert name of month of textbox date in database how i can do
Posted
Comments
The14thNoah 19-Feb-14 3:04am    
can you show the value that is put on textbox after selecting the date?
Member 10426233 19-Feb-14 3:22am    
like i insert 2/19/2014 in textbox and then click on submit button the only month(Feb) insert into database in asp.net c#
The14thNoah 19-Feb-14 4:01am    
so you just want to insert only the month like for example 2/19/2014 so 2 or February is the data you want to save right?
Please try my code below. . .
Sergey Alexandrovich Kryukov 19-Feb-14 3:31am    
Question? Where?
—SA

1 solution

try this

C#
var sepString=(textBox1.Text).Split('/');//seperate the date,day,and year

var index=1;
 String[] month = new String[] { "month", "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" };


            while (index > 13)
            {
                if (sepString[0] == index)
                {
                    m = month[index].ToString();
                    break;
                }
                else
                {
                    index++;
                }
             m;//use this to save it in database which has the value of month(February)
            }
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900