Benvor
asked on
Problem with sql and datetime column
Hi experts
I have a Access db and there is a column named "DateTime" and when I try to populate a combobox with the value then I only get "System.Data.DataRowView". I know its because "DateTime" is some kind of reserved word because if I change it, it works and displays the dates from the db. Is there a way to still use this column name and get the combobox to display tha data with "DateTime"?
Thanx in advance
I have a Access db and there is a column named "DateTime" and when I try to populate a combobox with the value then I only get "System.Data.DataRowView".
Thanx in advance
Dim myaccessdbpath As String = myapath
Dim connection As OleDbConnection = CreateConnection(myaccessdbpath)
connection.Open()
Dim command As New OleDbCommand()
command.CommandText = "SELECT Table.[DateTime] FROM Table"
command.Connection = connection
Dim dt As New DataTable()
Dim da As New OleDbDataAdapter(command)
da.Fill(dt)
frmRoadCall.cbxdatetime.DataSource = dt
frmRoadCall.cbxdatetime.DisplayMember = "Table.[DateTime]"
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Works excellent thank you Abedelhady.
frmRoadCall.cbxdatetime.Di