iwahdan
iwahdan

Reputation: 449

DataSet not Filled after using ReadXml Method C++/CLI

I was trying to read XML data from file and load it to Dataset, but i always get an empty dataset, here is my Code:

bool Replacer::Load_XmlTmp(System::String^ File_Path, System::String^ ErrMssg)
{
    ErrMssg = "";
    try
    {
        SnippetDataSet->ReadXml(File_Path, System::Data::XmlReadMode::ReadSchema);
    }
    catch (System::Exception^ e)
    {
        ErrMssg = e->Message;
        return false;
    }
    return true;
}

Noting that i have no Exceptions caught

here is my XML file:

<?xml version="1.0" encoding="utf-8" ?>
<Menu-DataSet xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <Snippit>
        <Original>NA</Original>
        <Replacment>NA</Replacment>
        <Type>NA</Type>
        <File>NA</File>
        <SnippitID>NA</SnippitID>
        <BugReportNum>NA</BugReportNum>
        <WorkAroundJustification>NA</WorkAroundJustification>
        <SW_Version>NA</SW_Version>
        <IsReused>NA</IsReused>
        <IsReplaced>NA</IsReplaced>
        <BugTRAQ>NA</BugTRAQ>
    </Snippit>
</Menu-DataSet>

Here is the DataSet properties when being watched in debug:

Error

Upvotes: 0

Views: 52

Answers (1)

iwahdan
iwahdan

Reputation: 449

I've Found the reason for this behavior, The visual Studio debug has problems displaying contents of the DataSet, but actually the DataSet is filled with the XML data

Upvotes: 1

Related Questions