I am creating a datagridview object from a query I pass into OleDB.
My code generates the table just fine, but my columns that have date time values display them with the long date and time format, rather then how i want them to display. (I want the short time format 08:00 AM)
Private Sub CallEntry_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim mcn As String
Dim ad As OleDbDataAdapter
Dim ds As DataSet
Dim cm As OleDbCommand
mcn = "Provider=Microsoft.Jet.OLEdb.4.0;Data Source=C:\Calls.mdb"
Dim myConnection As New OleDbConnection(mcn)
cm = New OleDbCommand("SELECT Location,Program,CallStartTime,CallEndTime,SecondC all FROM Calls WHERE Analyst = " & txtvalue.Text, myConnection)
ad = New OleDbDataAdapter(cm)
ds = New DataSet
Try
ad.Fill(ds)
DataGrid1.DataSource = ds.Tables(0)
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
End Sub
If anyone can tell me how to make my two date columns containing the short dates, please let me know.
Slyverson
[email protected]