Hi,
im trying to display a report of information from an access 2000 database in a datagrid in my app. The problem is that it only shows the date and not the specific time, in a column used for showing the date and time a record was made in the database.
heres the code
Try
objConn.Open()
objDataAdapter.Fill(objDS, "REPORTS")
Catch ex As System.Exception
MsgBox(ex.Message)
Finally
If objConn.State = ConnectionState.Open Then
objConn.Close()
End If
End Try
objReportsTable.Rows.Clear()
objReportsTable = (objDS.Tables("REPORTS"))
lets the datagrid know that the dateandtime column holds both the data and the time
objReportsTable.Columns("DATEANDTIME").DataType = System.Type.GetType("System.DateTime")
Dim objFrmReport As New frmReport()
objFrmReport.datReport.DataSource = objReportsTable
objFrmReport.Show()
the try statement fills up the dataset with the data into a table called REPORTS, i then extract that table into a DataTable type variable, i then assign the datatable as the datasource of the datagrid and display.
I found another thread on here with the same problem and the suggestion was to declare the datatype of the column which is what ive implemented in the command on the 4th line from the bottom of the code.
Any ideas why this isnt working?
im trying to display a report of information from an access 2000 database in a datagrid in my app. The problem is that it only shows the date and not the specific time, in a column used for showing the date and time a record was made in the database.
heres the code
Try
objConn.Open()
objDataAdapter.Fill(objDS, "REPORTS")
Catch ex As System.Exception
MsgBox(ex.Message)
Finally
If objConn.State = ConnectionState.Open Then
objConn.Close()
End If
End Try
objReportsTable.Rows.Clear()
objReportsTable = (objDS.Tables("REPORTS"))
lets the datagrid know that the dateandtime column holds both the data and the time
objReportsTable.Columns("DATEANDTIME").DataType = System.Type.GetType("System.DateTime")
Dim objFrmReport As New frmReport()
objFrmReport.datReport.DataSource = objReportsTable
objFrmReport.Show()
the try statement fills up the dataset with the data into a table called REPORTS, i then extract that table into a DataTable type variable, i then assign the datatable as the datasource of the datagrid and display.
I found another thread on here with the same problem and the suggestion was to declare the datatype of the column which is what ive implemented in the command on the 4th line from the bottom of the code.
Any ideas why this isnt working?