I am trying to add a new record to an access data base using the INSERT INTO sql function, my code is getting the following error
OLEDb excpetion was unhandled: Syntax error in INSERT INTO statement.
I believe ive managed to narrow it down to the datetimepicker.
both datetimes are set to short format.
ive tried using the following formats for the date field also.
CODE
cboDate.Value.ToShortDateString
CODE
System.Convert.ToDateTime(cboDate.Value).ToOADate
The System.convert generated this error:
InvalidCastException was unhandled: Conversion from string "INSERT INTO tblCaseAdmin ( Digit" to type 'Double' is not valid.
I have also tried changing the date format in VB to custom and setting custom to mm/dd/yyyy, but this gave me a date of 00/10/2008 for some reason.
Current code:
CODE
Dim addUser As String = "INSERT INTO tblCaseAdmin ( Digit, Day ) VALUES (" + cboDigit.Text & "," + cboDate.text + ")"
Dim cmd As OleDbCommand = New OleDbCommand(addUser, conn)
'The Error is being flagged on this line
cmd.ExecuteNonQuery()
Any ideas?
Sorry if this is a repost, and thank you for the help.