I'm trying to save data from 2 variables in a table, but when I look at the table in the database the values are recorded as 0.
public void inserir(List<Conta>list)
{
List<Conta> lista = new List<Conta>();
lista = list;
try
{
MySqlConnection onclick = new MySqlConnection("server = localhost; port=3306; User Id=root; database = 2.0 banco; password =");
onclick.Open();
MySqlCommand onCmd = new MySqlCommand("INSERT INTO CONTA(nome, cpf) VALUES (nome = @nome, cpf = @cpf)", onclick);
onCmd.Parameters.AddWithValue("@nome",lista[lista.Count-1].GetNome());
onCmd.Parameters.AddWithValue("@cpf", lista[lista.Count - 1].GetCpf());
onCmd.ExecuteNonQuery();
MessageBox.Show("Cadastrado com sucesso: " + lista[lista.Count - 1].GetCpf());
}
catch(Exception erro)
{
MessageBox.Show("Erro ao cadastrar: " + erro);
}
}
}