Did you debug???
One good place to place a breakpoint would be here:
Code:
Dim myCommand As New OleDbCommand(myQuery)
Then view the value of the
myQuery variable and see if the query makes sense.
I would note that you are *NOT* protecting yourself against SQL Injection (admittedly not a huge problem with OLE DB limitations) and you aren't allowing a name of (for example)
O'Brien
You'd be better off using a parameterized command, but at a minimum you should do
Code:
Dim name As String = Replace(name1.Text,"'","''")
Dim nric As String = Replace(nric1.Text,"'","''")
Also, as a minor point, the proper string concatenation operator in
VB is the ampersand (&). You can use + but you are at the whim (okay the rules) of
VB as to whether it does arithmetic or concatenation.
But anyway, start by debugging.