-2
Error 1 No Overload for method 'Inherited method' takes 1 Arguments
Code:
public void restauraRegistro(DataGridViewRow linha)
{
try
{
string codigo = String.Empty;
//verifica se e para recuperar com outro codigo
if (this.checkRecuperaOutroCodigo.Checked)
codigo = this.conexaoBanco.proximoCodigo(this.tabela).ToString(); //Limha do erro
MySqlCommand sql = this.conexaoBanco.criaComandoSQL ("sp_restaura_registro");
sql.Parameters.Add(new MySqlParameter("sp_codigo", linha.Cells["codigo"].Value));
sql.Parameters.Add(new MySqlParameter("sp_tabela", this.tabela));
sql.Parameters.Add(new MySqlParameter("sp_codigo_novo", codigo));
this.conexaoBanco.executaQuery(sql);
//remove do datagrid a linha
this.gridRegistrosDeletados.Rows.RemoveAt(linha.Index);
this.removeuRegistro = true;
}
catch (MySqlException erro)
{
this.removeuRegistro = false;
MessageBox.Show("Ocorreu um erro ao restaurar o registro.\nErro: " + erro.Message, "Atenção!", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
Method called
/// <summary>
/// Retorna o próximo codigo da tabela
/// </summary>
/// <param name="tb">Nome da Tabela</param>
/// <param name="pk">Nome do Campo</param>
/// <returns>inteiro proximo codigo</returns>
public int proximoCodigo(string tb, string pk)
{
int resultado = 0;
MySqlCommand cmd = new MySqlCommand("sp_proximo_codigo", objConnection);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add(new MySqlParameter("_data_base", "folha"));
cmd.Parameters.Add(new MySqlParameter("_tabela", tb));
cmd.Parameters.Add(new MySqlParameter("_campo", pk));
if (!this.OpenConnection())
return 0;
MySqlDataReader dataReader = cmd.ExecuteReader();
while (dataReader.Read())
resultado = int.Parse(dataReader["retorno"].ToString());
dataReader.Close();
this.CloseConnection();
return resultado;
}
Check the method signature
proximoCodigo
, you certainly do not receive a parameter (you can receive more or less).– João Martins
I’m making this mistake, Aug can help me :(
– vinibsc
ERROR: Error 1 No Overload for method 'Inherited method' takes 1 Arguments
– vinibsc
Within the method
proximoCodigo
is evoking that method? Check the signature of both methods.– João Martins
Damn, I didn’t even see that method
proximoCodigo
was in your code.– João Martins