Click here to Skip to main content
15,911,139 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionAnyone I need some advice and would like to be directed in the right direction if possible. Pin
FISH7864-Mar-09 16:08
FISH7864-Mar-09 16:08 
AnswerRe: Anyone I need some advice and would like to be directed in the right direction if possible. Pin
Stephen Hewitt4-Mar-09 16:26
Stephen Hewitt4-Mar-09 16:26 
GeneralRe: Anyone I need some advice and would like to be directed in the right direction if possible. Pin
FISH7864-Mar-09 16:45
FISH7864-Mar-09 16:45 
GeneralRe: Anyone I need some advice and would like to be directed in the right direction if possible. Pin
Stephen Hewitt4-Mar-09 16:49
Stephen Hewitt4-Mar-09 16:49 
GeneralRe: Anyone I need some advice and would like to be directed in the right direction if possible. Pin
FISH7864-Mar-09 17:07
FISH7864-Mar-09 17:07 
GeneralRe: Anyone I need some advice and would like to be directed in the right direction if possible. Pin
Stephen Hewitt4-Mar-09 17:19
Stephen Hewitt4-Mar-09 17:19 
GeneralRe: Anyone I need some advice and would like to be directed in the right direction if possible. Pin
FISH7864-Mar-09 17:22
FISH7864-Mar-09 17:22 
QuestionProblem reading xml string into data table Pin
Renukapadhamanaban4-Mar-09 12:36
Renukapadhamanaban4-Mar-09 12:36 
Hi,

I am wanted to convert/store a string, which has XML elements, into a dataset or data table. The string that I am reading from a service is the result of my query. I have written the following code,

{
DataSet ds = new DataSet();

StringReader stream = new StringReader(xmlString);

ds.ReadXml(stream);

DataTable dt = ds.Tables[0];

dg.DataSource = dt;

return dt;
}

I am receiving two different type of strings, they are

xmlString1:

<?xml version="1.0" encoding="UTF-8"?>
<nh:rows xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:nh="http://nhdb">
<nh:urnumber>0123456</nh:urnumber>
<nh:surname>xxxxx</nh:surname>
<nh:forename>yyy</nh:forename>
<nh:middlename></nh:middlename>
<nh:dob>1958-10-05</nh:dob>
<nh:address>Mxaxixlx</nh:address>
<nh:suburb>Prxxxx</nh:suburb>
<nh:state>Vxxx</nh:state>
<nh:postcode>3072</nh:postcode>
<nh:patientphone>phone</nh:patientphone>
<nh:gender>Female</nh:gender>
<nh:unit>Sxxxxx Oxxxx</nh:unit>
<nh:ward>Bxxx DPxx</nh:ward>
</nh:rows>


xmlString2:

<?xml version="1.0" encoding="UTF-8"?>
<nh:rows xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:nh="http://nhdb">
<nh:urnumber>0123450</nh:urnumber>
<nh:surname>Cxxxxxx</nh:surname>
<nh:forename>RxxxxxT</nh:forename>
<nh:middlename></nh:middlename>
<nh:dob>1954-07-19</nh:dob>
<nh:address>&apos;ANNANDALE&apos;</nh:address>
<nh:suburb></nh:suburb>
<nh:state></nh:state>
<nh:postcode></nh:postcode>
<nh:patientphone></nh:patientphone>
<nh:gender>Male</nh:gender>
<nh:unit></nh:unit>
<nh:ward></nh:ward>
<nh:urnumber>0123451</nh:urnumber>
<nh:surname>KROL</nh:surname>
<nh:forename>ANILLA</nh:forename>
<nh:middlename></nh:middlename>
<nh:dob>1958-12-10</nh:dob>
<nh:address>68A CLARENCE</nh:address>
<nh:suburb></nh:suburb>
<nh:state></nh:state>
<nh:postcode></nh:postcode>
<nh:patientphone></nh:patientphone>
<nh:gender>Female</nh:gender>
<nh:unit></nh:unit>
<nh:ward></nh:ward>
<nh:urnumber>0123452</nh:urnumber>
<nh:surname>GEYER</nh:surname>
<nh:forename>MAUREEN</nh:forename>
<nh:middlename></nh:middlename>
<nh:dob>1948-06-02</nh:dob>
<nh:address>19 JAYSON</nh:address>
<nh:suburb></nh:suburb>
<nh:state></nh:state>
<nh:postcode></nh:postcode>
<nh:patientphone></nh:patientphone>
<nh:gender>Female</nh:gender>
<nh:unit></nh:unit>
<nh:ward></nh:ward>
</nh:rows>

The above code works perfectly for the xmlString1 and it is converting a data table with single row of data for the cloumns urnumber, surname, forename, middlename, dob, address, suburb,state, postcode,patientPhone, gender, unit, ward.

When I am receiving the xmlString2, the data table is populated with only one column urnumber_Text(for all ur numbers in the xml string).

What am I missing here? Is there any other genuine way of doing it?

Thanks a Lot for your valuable time and invaluable advice.

Looking for advice,
Renu
QuestionHttpSendRequest Pin
Steve Thresher4-Mar-09 12:26
Steve Thresher4-Mar-09 12:26 
QuestionHelp Accessing Functions in a Dll Pin
Naturality4-Mar-09 10:17
Naturality4-Mar-09 10:17 
AnswerRe: Help Accessing Functions in a Dll Pin
Stuart Dootson4-Mar-09 10:28
professionalStuart Dootson4-Mar-09 10:28 
GeneralRe: Help Accessing Functions in a Dll Pin
Naturality5-Mar-09 5:17
Naturality5-Mar-09 5:17 
GeneralRe: Help Accessing Functions in a Dll Pin
Stuart Dootson5-Mar-09 15:56
professionalStuart Dootson5-Mar-09 15:56 
QuestionHow can I have tow different view type of the same document in a SDI Doc-View based app? Pin
Joseph Marzbani4-Mar-09 9:41
Joseph Marzbani4-Mar-09 9:41 
AnswerRe: How can I have tow different view type of the same document in a SDI Doc-View based app? Pin
Stuart Dootson4-Mar-09 10:22
professionalStuart Dootson4-Mar-09 10:22 
GeneralRe: How can I have tow different view type of the same document in a SDI Doc-View based app? Pin
Joseph Marzbani4-Mar-09 18:09
Joseph Marzbani4-Mar-09 18:09 
AnswerRe: How can I have tow different view type of the same document in a SDI Doc-View based app? Pin
«_Superman_»4-Mar-09 17:16
professional«_Superman_»4-Mar-09 17:16 
QuestionConfused Pin
su_penguin4-Mar-09 8:40
su_penguin4-Mar-09 8:40 
AnswerRe: Confused Pin
Adam Maras4-Mar-09 9:04
Adam Maras4-Mar-09 9:04 
GeneralRe: Confused Pin
su_penguin4-Mar-09 9:32
su_penguin4-Mar-09 9:32 
GeneralRe: Confused Pin
CPallini4-Mar-09 10:10
mveCPallini4-Mar-09 10:10 
GeneralRe: Confused Pin
«_Superman_»4-Mar-09 17:20
professional«_Superman_»4-Mar-09 17:20 
AnswerRe: Confused Pin
Jijo.Raj4-Mar-09 16:38
Jijo.Raj4-Mar-09 16:38 
QuestionInfantile question? Pin
Ric Ashton4-Mar-09 8:00
Ric Ashton4-Mar-09 8:00 
AnswerRe: Infantile question? Pin
Eytukan4-Mar-09 8:04
Eytukan4-Mar-09 8:04 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.