I'm using Visual Studio 2015, Visual Basic Language. I want to INSERT INTO an Access Database a username ('Utilizador' in the code). This is the code I have:
Try
Dim nconnect As New OleDbConnection("Provider=Microsoft.ACE.OleDb.12.0;" & "Data Source =|DataDirectory|S_Campo.accdb")
nconnect.Open()
Dim ncmd As OleDbCommand = nconnect.CreateCommand()
ncmd.CommandText = "INSERT INTO Utilizador (Nome) VALUES (@p1)"
ncmd.Parameters.AddWithValue("@1", Me.TextBox5.Text) 'Nome Do Utilizador
ncmd.ExecuteNonQuery()
nconnect.Close()
MsgBox("Utilizador lançado com êxito", MsgBoxStyle.OkOnly, "Informação")
Catch ex As Exception
MessageBox.Show(Err.Description)
End Try
It doesn't return me any error message, but the Data is not sent to the Database. However, UPDATE, and DELETE is working fine, using 'Parameters'.
What can is wrong with it?