none
Object cannot be cast from DBNull error RRS feed

  • Question

  • I am trying to import an xml file into an application.

    When I run this code it works fine:

    <?

     

    xml version="1.0" encoding="utf-8"?>
    <
    Star>
    <
    StarUser INumber="598623457"> 

    <

     

    Staff>
    <
    studentNumber>333</studentNumber>
    <
    cpso>888</cpso>

    </

     

    Staff>
    </
    StarUser>
    </
    Star>


    but if I use any other field in place of INumber I get an error:

    The Xml Data Import failed : : Object cannot be cast from DBNull to other types.

    Here is the relevant part of the schema:

    <

     

    xs:attribute name="UserId" type="xs:string" use="optional" />
    <
    xs:attribute name="externalId" type="xs:string" use="optional" />
    <
    xs:attribute name="UnivEmployeeId" type="xs:string" use="optional" />
    <
    xs:attribute name="UnivStudentId" type="xs:string" use="optional" />
    <
    xs:attribute name="FirstName" type="xs:string" use="optional" />
    <
    xs:attribute name="LastName" type="xs:string" use="optional" />
    <
    xs:attribute name="BirthYear" type="xs:string" use="optional" />
    <
    xs:attribute name="BirthMonth" type="xs:string" use="optional" />
    <
    xs:attribute name="BirthDay" type="xs:string" use="optional" />
    <
    xs:attribute name="CpsId" type="xs:string" use="optional" />
    <
    xs:attribute name="INumber" type="xs:string" use="optional" />

     

     


    I thought I should be able to use any these fields as the identifier - but for some reason it only lets me use INumber.
    Any Ideas why?


    Friday, April 3, 2009 3:38 PM

All replies

  • Give more information what code are you using to "import" Xml file? etc.etc. now we don't have enought to make a suggestion.
    Leonid Ganeline [BizTalk MVP] http://geekswithblogs.net/leonidganeline
    Monday, April 13, 2009 1:32 AM