1
I have a WS which has a method in which a list of Nodes with some data is inserted. I receive this data as Xmldocument, ride the knot Parameters reading the content inside it, after that I take the data and fill in the parameters of my Procedure to insert into the base.
However there is the possibility of case the data sent via WS is null, the node is not created, and when I try to read the error node.
In which way I can check if the node exists and if not insert NULL in the parameter of Procedure?
Follow the code I’m using to validate this, but it returns error
cmdMailingRetorno.Parameters.AddWithValue(
"@DataHoraFim",
Telefones[i]["DataHoraFim"].HasAttributes ?
(DateTime?)null :
Convert.ToDateTime(Telefones[i]["DataHoraFim"].InnerText)
);
I don’t understand, when the value is
null
you getnull
on the Node or it does not exist?– Leandro Angelo
@Leandroangelo from what I understand, the knot does not exist in the answer.
– Oralista de Sistemas
Rewriting an xml deserializer. That’s exactly what it does. From an object, it feeds the fields that are declared in xml and leaves with the default value those that are not.
– Diego Rafael Souza
There is a possibility that if the data sent is null the node is not created!
– Victor Augusto