I can not insert data in access from C #

0

I do not know where the problem is, it does not give me any kind of exception, it just runs and goes on, but it does not insert the data in access.

    static OleDbConnection con = new OleDbConnection(@"Provider = Microsoft.ACE.OLEDB.12.0; Data Source="+AppDomain.CurrentDomain.BaseDirectory+"Leaderboard.accdb");
    static OleDbCommand comando;

    public static void highscore(int puntuacion, String nombre)
    {
        try { 
        String query;
        con.Open();

        query = "Insert into Leaderboard(Nick,Puntuacion) Values('"+nombre+"','"+puntuacion+"')";

        comando.CommandText = query;
        comando.ExecuteNonQuery();

        con.Close();
        }catch(Exception e)
        {
            Auxiliar.log(e.Message);

        }
    }
    
asked by Aritzbn 15.02.2018 в 17:15
source

1 answer

1

I was missing the OLEDB provider to insert data in acces.

The provider 'Microsoft.ACE.OLEDB.12.0' is not registered on the local machine. I leave the link in case someone has the same problem or something.

  

link

    
answered by 15.02.2018 / 17:37
source