Hi all!. I am having a problem when trying to insert a new row in the database. No Errors are showing up but when i check the MS-Access database, the new row is not there. Iam reading the contents from 3 controls as shown in code below:
Please, can some one tell me what's wrong with my code or is there any other way of inserting records in a table? Thanks very much in advance.
VB.NET:
If con.State = ConnectionState.Closed Then
con.Open()
End If
dim insert as string
Try
insert = _
"INSERT INTO MeetingsDate(Dates, EntryType, Category) VALUES('" & DateTimePicker1.Text & "','" _
& cboDetailsType.Text & "','" & cboMeetingType.Text & "')"
saveData() 'Some function to write details to a text file
Dim Cmd As New OleDbCommand(insert, con)
Cmd.ExecuteNonQuery()
MessageBox.Show("Your entry has been succesfully saved...", "Entry Saved", _
MessageBoxButtons.OK, MessageBoxIcon.Information)
Catch
MsgBox(Err.Description & " " & Err.Source)
End Try
con.Close()