I have a access database,data type are "TEXT" for all fields
When i update the database date field appears as 2010-10-22. I want to load it as 10/22/2010. Please advise me what is wrong with my code
Code:
mydate = CalScheduler.SelectionStart() 'Date selected on month Calander
txtDay.Text = mydate.DayOfWeek.ToString 'extracting the day of week from the date
txDate.Text = mydate.ToShortDateString()
Try
newrow = DsDateExt1.tblDate.NewRow
'Schedule.newrow = newrow
newrow("SchDate") = CStr(txtDate.Text)
newrow("SchTime") = CStr(txtTime.Text)
newrow("JobType") = CStr(txtType.Text)
newrow("CustomerID") = CStr(txtID.Text)
newrow("Comments") = CStr(txtRemarks.Text)
DsDate1.tblDate.Rows.Add(newrow)
daDate.Update(DsDate11)
i did try to format date using this code
Code:
Dim theDate As DateTime = txtDate.Text
Dim ymd As String = theDate.ToString("MM/dd/yyyy")
and then replacingthe txtdate.text to ymd in row update code
newrow("SchDate") = CStr(txtDate.Text)
but result is same. It appears in table as 2010-10-22. The real question here is not the date format but what is happening while updating the table in data base