Estou usando um dao connection , ele está fazendo tudo certo, incluindo excluindo, o problema é no alterar, estou usando um boolean e programando o gravar e alterar no mesmo botão entendeu? Por exemplo quando eu clico no botão incluir ele manda para a tela de cadastro e o boolean é true, mas quando eu clico no cadastro diretamente pelo dblclick no flexgrid o boolean muda para false e o gravar para update! Bem, pra facilitar vou mandar a linha de código completa Dim strsql As String
Dim strsql2 As String
If validacaodoscampos = True Then
If blnIncluir = True Then
If txt_pop = "" Then txt_pop = 0
If txt_rpc = "" Then txt_rpc = 0
strsql = "Insert Into cidades (nome,estado,populacao,renda_per_capta)"
strsql = strsql & " Values (" & "'" & txt_nome & "','" & cmb_est & "'," & txt_pop & "," & txt_rpc & ")"
db.Execute strsql
Else
strsql2 = "Update cidades set (nome = " & "'" & txt_nome & "', estado = '" & cmb_estado & "', populacao = " & txt_pop & ", renda_per_capta = " & txt_rpc & ")"
db.Execute strsql2 'O erro aparece nessa linha'
End If
fra_cad.Visible = False
PreencherMSFlexGrid
cmd_exc.Visible = True
habilitapes
Else
txt_nome.SetFocus
End If
End Sub