Format Date to time field
How do I format a field from Access Database which is placed in a Datafield. The result of my Dataset fill returns a full date, for the 'StartTime' and 'EndTime' when all I want is the time? * Please note that in Access I have the field properties shown correctly..
Dim conStr As String = "Provider=Microsoft.Jet.OLEDB.4.0;User ID=Admin;Data Source=C:\DATA\ACCESS\NameDatabase"
Dim strSQL As String = "SELECT [ItemName], [StartDate],[Requests].[StartTime],[EndDate],[EndTime],[Name] FROM(Requests) "
strSQL = strSQL & "WHERE (([ItemName]= '" & nItem & "')"
strSQL = strSQL & "AND (([StartDate])"
strSQL = strSQL & "BETWEEN #" & kStart & "#"
strSQL = strSQL & "AND #" & kStop & "#));"
Dim conn As OleDbConnection = New OleDbConnection(conStr)
conn.Open()
Dim da As OleDbDataAdapter = New OleDbDataAdapter(strSQL, conn)
Dim ds As DataSet = New DataSet()
da.Fill(ds, "Requests")
Dim dv As DataView = ds.Tables("Requests").DefaultView
DataGrid1.DataSource = dv
conn.Close()
|