Click here to Skip to main content
15,894,343 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
how can i put a date in my datetimepiker from a request sql
Posted
Comments
Prerak Patel 18-Aug-11 6:58am    
Not clear
amineel9 18-Aug-11 6:59am    
i take my data from my sql data base and i would to put a date in a date time picjer how can i do it ?

Read the value from the database in your usual manner, and set the DateTimePicker Value property:
C#
myDateTimePicker.Value = new DateTime(1994, 11, 17);
 
Share this answer
 
Comments
amineel9 18-Aug-11 7:04am    
i test DateTimePicker1.Text = dtr.getdatetime(5) but it does'nt work
OriginalGriff 18-Aug-11 7:10am    
Read the answer: myDateTimePicker.Value not myDateTimePicker.Text
This[^] may help.
 
Share this answer
 
I think you want to put Date value from your database to DateTimePicker control, if I am not wrong.

You can do this by assigning your Date value to DateTimePicker's Value property like this

VB
DateTimePicker.Value =Convert.ToDateTime(DataRow(0)("date")) 
 
Share this answer
 
v2
Comments
amineel9 18-Aug-11 7:17am    
but i take a date from a data readre you see?
modifparam.DateTimePicker1.Value = dtr.GetDateTime(5).ToShortDateString
that's the solution it's work thks you all :)
 
Share this answer
 

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