Jump to content
asdifnot

Ajuda - Insert Into (erro ?)

Recommended Posts

asdifnot

Boas !! Estou aqui com um pequeno problema a tentar inserir dados numa tabela em base de dados Access.

O código que tenho é este:

Private Sub BTguardar3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BTguardar3.Click
        SQL002 = "INSERT INTO infraest (nome,tipo,local,lotacao) VALUES ('" & TBnomeinf.Text & "','" & CBtipoinf.Text & "','" & TBlocalinf.Text & "','" & TBlotacao.Text & "')"
        Dim cmd As New OleDbCommand(SQL002, dbconn)
        If dbconn.State = ConnectionState.Open Then dbconn.Close()
        dbconn.Open()
        cmd.ExecuteNonQuery()
        dbconn.Close()
        menuinicio.Show()
        Me.Close()
    End Sub

As variáveis estão numa página à parte, ou seja, globais. O problema é que isto está a dar erro de sintaxe no Insert Into.

Não encontro nenhum erro, portanto decidi tentar vir aqui e ver se alguém me pode ajudar.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.