i can't get DateTimePicker to insert into Access databse. I've tried all the suggestion i can find from this forum, so i'm thinking my problem is different?

my table has a column date which has a Date/Time format

my code

Dim cmd As OleDbCommand
            Dim sqlstr As String, ans As Boolean
            Dim mydate As DateTime
            mydate = Me.dtPickerT.Value

            sqlstr = "INSERT INTO table(date) VALUES (" & mydate & ")"
            cmd = New OleDbCommand(sqlstr, con)


            ans = cmd.ExecuteNonQuery()

            If (ans = True) Then
                'message added
                MsgBox("success")
            Else
                MsgBox("not entered")   '' error
            End If
            cmd = Nothing

error message is: Syntax error in INSERT INTO statement. - Micorsoft Office Access Database Engine

the query returned by cmd is: INSERT INTO taken(date) VALUES (1/8/2012)

what did i do wrong?? Pls help :D

i'v even tried (#" & mydate & "#) and (" & dtPickerT.Value.ToString & ") etc :(

oh sorry guys, my bad :(

i was too careless... date seems to be a reserve words, so [date] fix the problem.

sorry again

Hi buddy!
It was good that you did not remmove this post. I found my answer here! I was wondering on how to actually insert datetime to access from VB date time picker. If you meet one person today, tell him/her that "We learn through others' mistakes".
Stay well!

is this for microsoft visual 2010?

by the way, does anybody knows how to link the date time picker and combobox microsoft visual studio 2010 to access database? I just really dont know.

help much appreciated

This question has already been answered. Start a new discussion instead.