Dataset - ReadXML method in master pages

Posted by Komminedi under ASP.NET on 12/30/2009 | Views : 2584 | Status : [Member] | Replies : 6
Hi,

I am trying to read xml into dataset in masterpage code behind file(C#). But I am not getting that method. Please help me in this. How I can read and display the XML using dataset?

Regards,
Ramu




Responses

Posted by: Virendradugar on: 12/30/2009 [Member] [MVP] Silver

Up
0
Down
Hi Komminedi,

It will helpful to solve your problem if you can post your code. Just for your reference, visit below given link.

http://support.microsoft.com/kb/311566

It will be helpful to you.

Thanks,
Virendra Dugar

Komminedi, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Mehulthakkar1 on: 12/30/2009 [Member] Starter

Up
0
Down
Hi,

Your XML should be in proper format, than and than only dataset will read the XML.

Find the below example:

StringBuilder sb = new StringBuilder();
sb.Append("<WOLIS><WOLI><ID>64AB130F-8407-45C9-9928-3B8538305E9C</ID><CompanyName>MBT</CompanyName><SiteId>A1</SiteId><TestCode>T1</TestCode><City>Pune</City><WOID>B35D123F-2F70-48B9-9A4B-09D1A19EF190</WOID></WOLI><WOLI><ID>9B236F64-CEC9-4CCB-9F11-BAC64670DC63</ID><CompanyName>Syntel</CompanyName><SiteId>A1</SiteId><TestCode>T1</TestCode><City>Pune</City><WOID>B35D123F-2F70-48B9-9A4B-09D1A19EF190</WOID></WOLI></WOLIS>");

DataSet ds = new DataSet();
ds.ReadXml(new StringReader(sb.ToString()));

Response.Write(ds.Tables[0].Rows.Count);


Hope this will help you out.

Thanks
Mehul Thakkar

Komminedi, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Komminedi on: 12/31/2009 [Member] Starter

Up
0
Down
Hi,

Thanks for your reply. But I am unable to see the method readXML() for dataset in masterpage codebehind file. I have included all the necessary namespaces.. Please help me in this.

Thankyou

Komminedi, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Virendradugar on: 12/31/2009 [Member] [MVP] Silver

Up
0
Down
Hi Komminedi,

It will helpful to solve your problem if you can post your code.

Thanks,
Virendra Dugar

Komminedi, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Nishithraj on: 12/31/2009 [Member] Bronze

Up
0
Down
If you are not getting the method of ReadXML,the problem might be you are trying to access it from the class directly.

Try to access the method from any method or event for example you can access the method ReadXML from pageload or button_click etc..

Mark this as answer, if it is.....

With regards
Nishithraj Narayanan

Komminedi, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Mehulthakkar1 on: 1/1/2010 [Member] Starter

Up
0
Down
If you have created object of DataSet and included namespace System.Data only then it should work for you. I don't think you have required any more namespace.

Check it once again.

Thanks
Mehul

Komminedi, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response