Registered data disappear

Asked

Viewed 27 times

0

The Registration form registers correctly in the database and if you exchange user with the open program it still accesses the registered data, but when it closes the program completely and opens again all the registered data some one knows what this can be? Obs - code below

 Private Sub Salva()

    Using con As OleDbConnection = GetConnection()

        Try

            con.Open()
            Dim sql As String = "INSERT INTO usuarios (login,senha,perfil) VALUES(?,?,?)"
            Dim cmd As OleDbCommand = New OleDbCommand(sql, con)

            cmd.Parameters.Add(New OleDb.OleDbParameter("@login", TextBox1.Text))
            cmd.Parameters.Add(New OleDb.OleDbParameter("@senha", TextBox2.Text))
            cmd.Parameters.Add(New OleDb.OleDbParameter("@perfil", ComboBox1.SelectedIndex))

            cmd.ExecuteNonQuery()

            MsgBox("Usuário Cadastrado Com Sucesso!", MsgBoxStyle.Information)

        Catch ex As Exception

            MsgBox("Ocorreu um erro ao tentar gravar um novo Usuário", MsgBoxStyle.Information)

        Finally

            con.Close()

        End Try

    End Using

    LimpaCampos()

End Sub
  • You are committing the transactions?

  • Can you view this data in the database (outside of the application)? Isn’t there a pending commit transaction in your program? If the last answer is YES this is probably the problem.

  • yes I am not using commit I am a bit new in this database but when the application is open the data appear in the database yes

  • If it appears outside of your program even while the application is open then it is not a transaction problem. The transaction would restrict the visible data to your application. It is necessary to check more details of your code that do some interaction with the BD in order to reach some conclusion. Unfortunately I have no way to test your code at the moment.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.