Date in dataset, change format, place in txtbx

frankm9639

Active member
Joined
Aug 24, 2006
Messages
25
Programming Experience
1-3
Can you tell me how this is done? I don't know if I should even do it this way. I am pulling data from the database into my dataset. The dates have the minutes, etc. still attached. I want to display a mm-ddm-yyyy on the screen. I thought of using an alias like this in the SQL:
----------------------------------------------------------
SELECT *, convert(nvarchar,PlanInception, 101) As PlanInceptionDate
FROM table1
----------------------------------------------------------
But then, how can I write this back to the database cause I'm now referencing the alias in the textbox? There has to be a better way to do this. Please help!
 

cjard

Well-known member
Joined
Apr 25, 2006
Messages
7,052
Programming Experience
10+
You would keep it as a date right the way through, and use a DatePicker control as the textbox, with a Custom format specified to make the date appear like you want..

DO NOT USE THE DATEPICKER.TEXT property for operations involving the date. Use the .Value property. VB does not guarantee that editing the .Text will cause the string to be converted to a date properly
 
Top Bottom