Usamos cookies para medir audiência e melhorar sua experiência. Você pode aceitar ou recusar a qualquer momento. Veja sobre o iMasters.
Olá, sou novo no forum e estou com alguns problemas na execução do meu código.Estou tentando inserir dados em uma tabela, porém acusa o seguinte erro:Run-time error '-2147217900(80040e14)':Erro de sintaxe na instrução INSERT INTOO código é o seguinte:Private Sub gravar_dados()Dim cnncomando As New ADODB.CommandDim vconfmsg As IntegerDim verro As Boolean vconfmsg = vbExclamation + vbOKOnly + vbSystemModal verro = False If txtnome.Text = Empty Then MsgBox "O campo NOME não foi preenchido!", vconfmsg, "Erro!" verro = True End If If txtmae.Text = Empty Then MsgBox "O campo MÃE não foi preenchido!", vconfmsg, "Erro!" verro = True End If If verro Then Exit Sub Screen.MousePointer = vbHourglass With cnncomando .ActiveConnection = cnncadint .CommandType = adCmdText If (vinclusao = True) Then .CommandText = "INSERT INTO servidor " & "(cod, nome, end, telefone, " & "rg, data_nasc, mae, pai, obs) VALUES ('" & txtcodigo.Text & "','" & txtnome.Text & "','" & txtend.Text & "','" & txttelefone.Text & "','" & txtrg.Text & "','" & txtdata_nasc.Text & "','" & txtmae.Text & "','" & txtpai.Text & "','" & txtobs.Text & "');" Else .CommandText = "UPDATE servidor SET " & "nome='" & txtnome.Text & "'," & "end='" & txtend.Text & "'," & "telefone='" & txttelefone.Text & "'," & "rg='" & txtrg.Text & "'," & "data_nasc='" & txtdata_nasc.Text & "'," & "mae='" & txtmae.Text & "'," & "pai='" & txtpai.Text & "'," & "obs='" & txtobs.Text & "' " & "WHERE cod=" & txtcodigo.Text & ";" End If .Execute End WithAlguém pode me ajudar?Grato
Carregando comentários...