how can get the birthday from database to dropdownlist
-
Hi, how I can get the birthday from column in database ( as datetime type ) and display it in a separate dropdownlist one for day and other for month and textbox for year . I want get the information to update on it . thanks .
Is it stored in the database as a DateTime? If so then you get the same way you would get any other column. Once you have the DateTime object you use the properties the structure, Day, Month, Year to get the constituent parts. In these situations I usually rely on a little trick I like to refer to as Reading the Documentation, or as some abbreviate it, RTFM
I know the language. I've read a book. - _Madmatt
-
Hi, how I can get the birthday from column in database ( as datetime type ) and display it in a separate dropdownlist one for day and other for month and textbox for year . I want get the information to update on it . thanks .
Why you aren't using
Calendar1
control? If you have to split birthday value in controls then use Year,Month,Day SQL Functions. e.gselect year(birthday) from mytable
select month(birthday) from mytable
select day(birthday) from mytable
I Love T-SQL "Don't torture yourself,let the life to do it for you." If my post helps you kindly save my time by voting my post. www.cacttus.com
-
Why you aren't using
Calendar1
control? If you have to split birthday value in controls then use Year,Month,Day SQL Functions. e.gselect year(birthday) from mytable
select month(birthday) from mytable
select day(birthday) from mytable
I Love T-SQL "Don't torture yourself,let the life to do it for you." If my post helps you kindly save my time by voting my post. www.cacttus.com
no I don't need to use the calender but I need only return birthdate from database into variable as DateTime and then spilt it into day to put it in the dropdownlist , month into another dropdownlist , year into textbox to update information about user .
-
no I don't need to use the calender but I need only return birthdate from database into variable as DateTime and then spilt it into day to put it in the dropdownlist , month into another dropdownlist , year into textbox to update information about user .
So, you can bind dropdowlists and textbox with query which I wrote you in previous post.
I Love T-SQL "Don't torture yourself,let the life to do it for you." If my post helps you kindly save my time by voting my post. www.cacttus.com
-
Why you aren't using
Calendar1
control? If you have to split birthday value in controls then use Year,Month,Day SQL Functions. e.gselect year(birthday) from mytable
select month(birthday) from mytable
select day(birthday) from mytable
I Love T-SQL "Don't torture yourself,let the life to do it for you." If my post helps you kindly save my time by voting my post. www.cacttus.com
So you want to use three query, with all the overhead, to return one value, DateTime, which already has the properties for Day, Month, Year. Even if you combined into one query it is still unnecessary to separate the values in the SQL statement.
I know the language. I've read a book. - _Madmatt
-
So you want to use three query, with all the overhead, to return one value, DateTime, which already has the properties for Day, Month, Year. Even if you combined into one query it is still unnecessary to separate the values in the SQL statement.
I know the language. I've read a book. - _Madmatt
That was only example about Year,Month,Day SQL functions.
I Love T-SQL "Don't torture yourself,let the life to do it for you." If my post helps you kindly save my time by voting my post. www.cacttus.com
-
Hi, how I can get the birthday from column in database ( as datetime type ) and display it in a separate dropdownlist one for day and other for month and textbox for year . I want get the information to update on it . thanks .
how I can get the birthday from column in database ( as datetime type ) and display it in a separate dropdownlist one for day and other for month and textbox for year . I want get the information to update on it . for that task first you have to create two dropdownlist for day and month and fill them. then try this code void BIndBirthDay() { DateTime _bdate = DateTime.Now; -- get this date from database field int day = _bdate.Day; -- return int value(find day of datetime field like that) drp_day.SelectedIndex = -1; drp_day.Items.FindByValue(Convert.ToString(day)).Selected = true; -- bind that perticulare day to dropdownlist by that } hope this helps and also same down for month (_bdate.Day) and year (_bdate.Year)
-
how I can get the birthday from column in database ( as datetime type ) and display it in a separate dropdownlist one for day and other for month and textbox for year . I want get the information to update on it . for that task first you have to create two dropdownlist for day and month and fill them. then try this code void BIndBirthDay() { DateTime _bdate = DateTime.Now; -- get this date from database field int day = _bdate.Day; -- return int value(find day of datetime field like that) drp_day.SelectedIndex = -1; drp_day.Items.FindByValue(Convert.ToString(day)).Selected = true; -- bind that perticulare day to dropdownlist by that } hope this helps and also same down for month (_bdate.Day) and year (_bdate.Year)