I'm trying to insert data into Oradores Table in Access using Visual Basic. The code I have is: 'Public Variables novo_nome_comum = TxtNComum.Text novo_nome_completo = TxtNCompleto.Text nova_morada = TxtMorada.Text nova_localidade = TxtLocalidade.Text novo_codpostal = TxtCPostal.Text novo_tel1 = TxtTel1.Text novo_tel2 = TxtTel2.Text novo_tlm1 = TxtTlm1.Text novo_tlm2 = TxtTlm2.Text novo_email1 = TxtMail1.Text novo_email2 = TxtMail2.Text nova_cong = TxtCong.Text 'End of Public Variables
Dim connect As New OleDbConnection("Provider=Microsoft.ACE.OleDb.12.0;" & "Data Source =C:\Users\Fernando\Documents\Visual Studio 2012\Projects\Agenda_DP\Agenda_DP\AgendaDP.accdb")
connect.Open()
Dim cmd As OleDbCommand = connect.CreateCommand()
cmd.CommandText = "INSERT INTO Oradores (NomeComum, NomeCompleto, Morada, Localidade, CodPostal, Telefone, Telefone2, Telemovel, Telemovel2, email, email2, Congregacao) VALUES('novo_nome_comum', 'novo_nome_completo', 'nova_morada', 'nova_localidade', 'novo_codpostal', 'novo_tel1', 'novo_tel2','novo_tlm1', 'novo_tlm2', 'novo_email1', 'novo_email2', 'nova_cong')"
cmd.ExecuteNonQuery()
connect.Close()
However, this is not working, and I don't understand why. I searched in MSDN and I'm copying the example quoted to my code. Is there anyone who could give me an hand? Thanks in advance.
Fernando Pessoa