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

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top