Convert a latebinded DataTable column's format from DateTime to string (or format the date time valu

  • Thread starter Thread starter RSH
  • Start date Start date
R

RSH

Hi,

I have a situation where I am using a dataset from a SQL Query. SQL's
DateTime is a "long date/time field" which includes the Date/Time. My
fields need to be displayed in a short time format "08:00" instead of
"1/1/1900 08:00 AM"? I can't alter the database table, I only want to
change the displayed value. How do I either change the datatable's column
datatype to a string...or specify the columns formatting?

How can I achieve this formatting to

Dim Con As OleDbConnection = New OleDbConnection(strCompanyConn)

oDA = New OleDbDataAdapter(spSQL, Con)

Dim myDataSet As New DataSet

oDA.Fill(myDataSet, "Shifts")

If myDataSet.Tables("Shifts").Rows.Count = 0 Then

Con.Close()

Con = Nothing

Else

Me.GridEX1.DataSource = myDataSet.Tables("Shifts")

Me.GridEX1.DataBind()



Con.Close()

Con = Nothing

End If



Thanks!

Ron
 
Back
Top