Avoid XML element if value is null

db , xml United States
  • 12 years ago

    Hi,

    I am writing xml file from sql server database(Stored Proc) using Xml text writer class ,i

    My query is ,If database  datacolumn value has" null" then ,i dont want to show null element in xml file

    means i dont need particular end element in xml file

     

    example:

    1.<ID>1908</ID>
      <LOCALID>0123456789</LOCALID>
      <Sname>1660</Sname>
      <State>NJ</State>
      <Zip>30824</Zip> 

    If State value is null

    2.<ID>1908</ID>
      <LOCALID>0123456789</LOCALID>
      <Sname>1660</Sname>
        <Zip>30824</Zip>

    I wanted out put like 2 xml file.Please suggest.

    Thanks in advance!!!.

  • 12 years ago

    Please reply anyone ASAP.

Post a reply

Enter your message below

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Nine people can't make a baby in a month.” - Fred Brooks