Question how to store and get date on DateTimePicker with SQL Database

mkhurram92

Member
Joined
May 27, 2011
Messages
16
Location
Jeddah(KSA)
Programming Experience
1-3
hell there

i m using VS2008 and i have a datetimepicker control on my form. what i need to

1. Store Just date in SQL Database after selecting from DateTimePicker
2. Get the Date from Database and want to show on the DateTimePicker..

How i can do that.
please help ???
 
1. The Value property of the DateTimePicker gets the DateTime value it stores. The Date property of that DateTime will get another DateTime containing the same date and the time zeroed.

2. You get all data from a database in exactly the same way. Once you have a DateTime, you assign it to the Value of the control.
 
When you create a column you have a drop-down list of available data types. Select the one that's most appropriate for the data that you want to store in it. It should be fairly obvious simply from the names in this case. In those where it isn't so obvious, the MSDN web site can tell you waht all the available data types are and what they mean.
 
Back
Top