The method or operation is not implemented c#

Asked

Viewed 2,137 times

0

I cannot identify the reason for this mistake, since I made other developments with this logic and it worked.

The method or operation is not implemented.

Follows code:

Method that starts the values:

 private void linkLblStatus_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            try
            {
                Pedido objPedido = new Pedido();
                RetornoSefaz objRetorno = new RetornoSefaz();
                objPedido.PedEmpresa = Metodos.empresa;
                objPedido.PedNumero = txtNumPedido.Text;
                if (objPedido.ConsultarNFPedido(Metodos.empresa, objPedido.PedNumero) > 0)
                {
                    if (objPedido.pedNFStatus == "Rejeitada" || objPedido.pedNFStatus == "Autorizada")
                    {
                        objRetorno.NFEmpresa = objPedido.PedEmpresa;
                        objRetorno.NFNumero = objPedido.pedNFNumero;
                        objRetorno.NFSerie = objPedido.pedNFSerie;
                        objRetorno.NFCliente = txtCodigo.Text;
                        objRetorno.NFTipo = objPedido.pedNFTipo;
                        List<RetornoSefaz> ListaRetorno = objRetorno.ListarRetornoSefaz();
                        if (ListaRetorno.Count > 0)
                        {
                            FrmStatusNF frmStatus = new FrmStatusNF(ListaRetorno);
                            frmStatus.ShowDialog();
                        }
                    }

                }
            }
            catch (Exception ex)
            {

                throw ex;
            }
        }

Listarretornosefaz where is causing the error:

Error happens on line : DataTable dt = SqlDAO.ConsultarSQL(strSql, listaParam.ToArray());

public List<RetornoSefaz> ListarRetornoSefaz()
        {
            try
            {
                List<SqlParameter> listaParam = new List<SqlParameter>();
               StringBuilder strSql = new StringBuilder();
                strSql.Append("SELECT * FROM VincoRetornoSefaz WHERE 1=1");

                if (!string.IsNullOrEmpty(NFEmpresa))
                {
                    strSql.Append(" AND NFEmpresa = @NFEmpresa ");
                    listaParam.Add(new SqlParameter("@NFEmpresa", NFEmpresa));
                }
                if (!string.IsNullOrEmpty(NFNumero))
                {
                    strSql.Append(" AND NFNumero = @NFNumero ");
                    listaParam.Add(new SqlParameter("@NFNumero", NFNumero));
                }
                  if (!string.IsNullOrEmpty(NFSerie))
                {
                    strSql.Append(" AND NFSerie =  @NFSerie");
                    listaParam.Add(new SqlParameter("@NFSerie", NFSerie));
                }
                if (!string.IsNullOrEmpty(NFCliente))
                {
                    strSql.Append(" AND NFCliente =  @NFCliente ");
                    listaParam.Add(new SqlParameter("@NFCliente", NFCliente));
                }
                if (!string.IsNullOrEmpty(NFTipo))
                {
                    strSql.Append(" AND NFTipo =  @NFTipo ");
                    listaParam.Add(new SqlParameter("@NFTipo", NFTipo));
                }
                strSql.Append(" ORDER BY NFINDENT DESC ");

                DataTable dt = SqlDAO.ConsultarSQL(strSql, listaParam.ToArray());
                return dt.ToList<RetornoSefaz>();

            }
            catch (Exception ex)
            {

                throw ex;
            }
        }
    }
  • 1

    Tentou alterar:&#xA;DataTable dt = SqlDAO.ConsultarSQL(strSql, listaParam.ToArray());&#xA;&#xA;Para:&#xA;var dt = SqlDAO.ConsultarSQL(strSql, listaParam.ToArray());&#xA;&#xA;Outra coisa, não é preciso criar uma instancia do SqlDAO?

  • @Ronaldoperes the stackoverflow formatter colors the word Sqldao because it has no way of knowing if it is a class or instance, so it assumes it is class. It can be a global object or inherited from a base. Or it really is a kkkk error

1 answer

4


Usually this error occurs when you use Visual Studio’s help to create members of an interface that has been added to a class you have created, take a look at this class SqlDAO, I’m pretty sure you’ll find the method ConsultarSQL with a throw NotImplementedException in it.

For more information about this exception: Notimplementedexception

Browser other questions tagged

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