Click here to Skip to main content
15,902,198 members
Please Sign up or sign in to vote.
3.00/5 (4 votes)
See more:
C++
DataTable dts = new DataTable();
                             dts.Columns.Add("heading_name");
                             dts.Columns.Add("sub_heading_name");
                             dts.Columns.Add("detail_text");
                             DataRow drs = dts.NewRow();
                             string heading_name = dr["heading_name"].ToString();
                             drs["heading_name"] = heading_name;
                             string detail_text = dr2["detail_text"].ToString();
                             drs["detail_text"] = detail_text;
                             dts.Rows.Add(drs);
                             DataSet mDs = new DataSet();
                             dts.TableName = "MyTable";
                             mDs.Tables.Add(dts);
                             mDs.WriteXmlSchema(Server.MapPath("XMLFile.xml").ToString());

I have a datatable, added columns and then I add datarows assigning from foreach loop. Then I create a dataset adding my datatable to it and call writexmlschema method. The problem is that my XML file is created but I it has columns not the actual data which is comin from database. I have watched in debug mode also in my variable data is coming but in XML only columns name are being shown.

I want it to write my data from the database into XML can anybody help me?



[Edit Keith Barrow:] The OP is speaking like an adult. Agreed the English is pretty poor, so I've fixed it

The reason the orignal text looked childish is because of the way the Arabic alphabet(used in Pakistan) works: The letter "Tha" ﺙ makes the sound "th" like the greek Theta or Booth. The letter dhal ﺫ which also sounds "th" (but as in "this" or "the" rather than "booth") but is normally transliterated to "dh" or sometimes "d". What the OP did was choose a wrong, but common English transliteration. This is akin to a German mixing up v/w and Arabs confusing b/p and f/v or English people confusing ﺱ/ﺹ or ﺡ/ﺥ/ﻩ or ﻕ/ﻙ or ﺽ/ﺩ for that matter. Unfortunately for the OP it does look like kiddie-speak because the letters he has confused happen sound the same as a child who can't form the "th" sound properly yet. Additionally the OP has also not used punctuation as Arabic text doesn't usually need it.
Posted
Updated 15-Apr-10 3:19am
v3

Calling the WriteXmlSchema method is the problem. This writes out the schema which is a definition od what XML file should contain and it structure (e.g.expected tags, attributes). Calling WriteXml instead will hopefully fix your problem.
 
Share this answer
 
TanzeelAhmed wrote:
in dis wat i m doin i


At this point I decided you're clearly a moron, and didn't read any more.


TanzeelAhmed wrote:
da problem is that ma


I scanned ahead. Yep, you ARE a moron.

This is an English speaking site, full of adults. Speak like an adult.

I disagree 100% with your comments Keith. The OP was not using phonetics, or having trouble with spelling. He was using the txtspeak that children use on their mobile phones. That is what I object to. Poor spelling, bad grammar, etc, I have no issue with at all.
 
Share this answer
 
v4
Dear god, Jar Jar Binks finally found Code Project.
 
Share this answer
 
My suggestion is to get yourself a frickin' dictionary and learn how to phrase a proper sentence. Immediately drop this crappy childish stupid looking textspeak.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900