Null Value with Repeating table Error - InfoPath Dev
in

InfoPath Dev

Use our Google Custom Search for best site search results.

Null Value with Repeating table Error

Last post 06-08-2012 06:44 AM by SeanPRyan. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 06-07-2012 11:48 AM

    • SeanPRyan
    • Top 200 Contributor
      Male
    • Joined on 02-02-2012
    • Kansas City area
    • Posts 52

    Null Value with Repeating table Error

    I have my new form working great except today I ran into an issue with null values.  I thought I was capturing the nulls, but I was wrong.

    rdr is my SqlDataReader

    if (rdr[EmailID] != null)
                            {

                                //this blows up on this line on the 32nd iteration of the loop when searching for an extended group.
                                EmpNewData.SelectSingleNode("/my:myFields/my:Emp/my:EmpData/my:email", NamespaceManager).SetValue(rdr.GetString(EmailID));
                            }
                            else
                            {
                                EmpNewData.SelectSingleNode("/my:myFields/my:Emp/my:EmpData/my:email", NamespaceManager).SetValue("No.Email");
                            }

    Thoughts?

    Oh, and yes, the email value is set to NULL in the DB Table. I want to capture this and continue to move on nonetheless.

    Thanks

    Sean
    Filed under: , , ,
  • 06-08-2012 06:44 AM In reply to

    • SeanPRyan
    • Top 200 Contributor
      Male
    • Joined on 02-02-2012
    • Kansas City area
    • Posts 52

    Re: Null Value with Repeating table Error

    I figured this out.  IsDBNull seems to take care of it.  I ran thru the code in debug to check where the ordinal sat. It was 14 in this case.

    int EmailID = rdr.GetOrdinal("EmailID");

    Then when using GetString:

    if (!(rdr.IsDBNull(14)))
    {
         EmpNewData.SelectSingleNode("/my:myFields/my:Emp/my:EmpData/my:email", NamespaceManager).SetValue(rdr.GetString(EmailID));
    }
    else
    {
         EmpNewData.SelectSingleNode("/my:myFields/my:Emp/my:EmpData/my:email", NamespaceManager).SetValue("No Email");
    }

    I hope this will help somebody :-)

    Cheers

    Sean
    Filed under: , ,
Page 1 of 1 (2 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.