DataSet.ReadXml Method does not read/load space

Hello,

There is a space(as a data) in one of the columns. And i save my DataTable 
as a xml file using DataSet. I used DataSet.WriteXml method to save as a xml 
file. Now if I read that .xml file using DataSet.ReadXml method,it removes 
space in that DataTable. Any idea...?


This does not work in Visual Studio .NET 2003. If I execute this in VS .Net 
2005, it works. I must make it work in VS 2003. 

Here there is a sample that does not work in VS NET 2003: 
________________________________________________________________________________

            DataTable dbTable = new DataTable();
            dbTable.Columns.Add(new DataColumn("MyColumn1", 
Type.GetType("System.String")));

            DataRow dbRow = dbTable.NewRow();
            dbRow["MyColumn1"] = "   ";
            dbTable.Rows.Add(dbRow);

            Console.WriteLine("Value = " + dbTable.Rows[0][0]);

            DataSet dbSet = new DataSet();
            dbSet.Tables.Add(dbTable);
            dbSet.WriteXml("C:\\MyFile.xml", XmlWriteMode.WriteSchema);

            dbRow = null;
            dbTable = null;
            dbSet = null;
        
            DataSet dbReadSet = new DataSet();            
            dbReadSet.ReadXml("C:\\MyFile.xml", XmlReadMode.Auto);

            Console.WriteLine("Value = " + dbReadSet.Tables[0].Rows[0][0]);

            dbReadSet = null;
--------------------------------------

0
8/14/2007 9:36:00 PM
dotnet.xml 7266 articles. 0 followers. Follow

0 Replies
1080 Views

Similar Articles

[PageSpeed] 9

Reply:

Similar Artilces:

Reading multiple values from another table.
I have a table with general information in it such as Subject, Reference Rumber, Comments. I would like to have another table with Company Reference and Responsibility. So when I create a new record including Subject and Reference Number, I could look up values from the second table to fill in multiple instances of Company Reference and Responsibility. A better example would be a form to order pizza. The main form would contain name, address, Size and type of pizza. Then from the same form, you would look up toppings from a seperate table to add multiple toppings to each instance of a pizza. ...

Read #2
Lady only 24-Hrs +91 9810577227 Send email to info@lenstar.org get access code. ...

Opportunity Retrieve method not returning Id
I am trying to add functionality to the CRM such that CRM has the ability to duplicate or copy existing opportunities in order to create a new opportunity. What I want to do is to create a "Copy Opportunity" button on the Opportunity form.The button allows to navigate to a custom aspx page. By enabling parameter passing, I can pass the object type (opportunity)and object id to the custom aspx page. The code behind for this custom aspx page should create the new opportunity using the CRMOpportunity Create method, and maybe just have a text box where the user could type the name of th...

Automagically create database schema from XML dataset
Hello. I am trying to create a database from an XML file. I am able to create a dataset from the XML doc, but how can I create a database schema from the dataset and populate the database? Or is this even possible using VS.NET 2003? Part of the XML file follows. Thanks for any help. Steven VS.NET 2003 and C# newbie! ----- Part of the XML (one full record across several tables) -------- <!DOCTYPE PubmedArticleSet...> - <PubmedArticleSet> - <PubmedArticle> - <MedlineCitation Owner="NLM" Status="Completed"><PMID>11604973</PMID> - &l...

how do i read directly off of a chart
i've set up a callibration curve in excel, I have experimental x values and want to obtain the corresponding y values without using FORECAST, TREND tec. any ideas? Mark - Search the newsgroup archives for 'interpolate' http://www.google.com/advanced_group_search or if you want to try to match the smoothed curve Excel draws arbitrarily through points, google the groups for 'Dave Braden' and 'cubic spline', or go to Brian Murphy's site, and look for the Excel Stuff link, which includes a treatment of the bezier function used by Excel to draw this curve:...

How to RANDOMLY split a whole dataset into two sub-dataset? #3
Hi, At your possible convenience, might anyone please kindly answer my question? How to RANDOMLY split a whole dataset (n=2000) into two sub dataset (n=1000, n=1000) in SPSS or Excel? Thank you very much. Please take care Caroline You have two answers in your other posting. Pete On Jul 17, 6:33 am, zencaroline <zencarol...@gmail.com> wrote: > Hi, > > At your possible convenience, might anyone please kindly answer my > question? > > How to RANDOMLY split a whole dataset (n=2000) into two sub > dataset (n=1000, n=1000) in SPSS o...

SSRS Linking Dataset
I have converted some reports in Access to SQL 2008 Reporting Services. However, some of the reports have subreports in them and they look fine in design but when I try to run the report previewing it from VS 2008 I get the main report but not the subreport. Apparently, the subreport is not tied to a Dataset even though the dataset shows up in the Report Data section on left side of VStudio. I cannot find anywhere in proerties to attach a dataset to the subreport. Also, how do I "link" the subreport to the main report to get only the correct records in the subrepo...

Spaces broken in 12.1.7
Version: 2008 Operating System: Mac OS X 10.5 (Leopard) Processor: Intel So. Finally upgraded from OfficeX to 2008 and by god if one of the main features of Mac OS that I use all the time, Spaces, isn't completely rooted using Office 2008!! Unusable! Come on MS! You have this big flashy web site that professes your "maciness" and how totally savvy and macced up to the max you are, and then fail to deliver on something as simple and fundamental as bloody spaces!! Its only a word processor and a spreadsheet program for gods sake and it must be the ONLY app I've come across tha...

OUTLOOK READ CONFIRMATION
We develloped an application to automate the import of a specific mailbox on a daily base. To make things easier we import the data into access, and then move the mails in outlook from the in-box to an archive folder; a very strange behaviour in this matter is that people who request for a 'read confirmation' get a message back that the mail was deleted without being read; is their an option that will never send back read or deliver confirmations (in outlook or exchange server); jm In Outlook you can set that here: Tools menu > Options > Email Options > Tracking "j...

Creating typed dataset from an industry standard schema
Has anyone run into problems creating typed datasets from complex schemas? I am attempting to create a Typed Dataset in Visual Studio .Net from a .xsd schema file for a industry standard web service. I have run the schema through XML Spy and validated it with no errors, but when attempting to generate a dataset, I keeping getting a 'undefined data type' error. The schema is quite large so I don't know if that is causing the problem or if it is just something odd about .Net's parser. Here is the section of the schema causing the problem. There are only two spots where the...

What does afx_msg mean in declaration of methods
Hello! Normally a declaration looks like this in standard C/C++ void OnLButtonDown(UINT nFlags, CPoint point); but in MFC it looks like this instead afx_msg void OnLButtonDown(UINT nFlags, CPoint point); What does this afx_msg mean? Is it really necessary? I just tested and removed it and this OnLButtonDown method worked in the same way as when I had this afx_msg. So this afx_msg didn't have any affect in my application. So what is the reason of having this afx_msg when it seems to have no affect? //Tony Thats just a coding Convention!, it make easier for ClassWizard to find th...

Winmail takes 4 minutes to load at boot time
Running Windows Vista Home Premium on Lenovo Laptop 2 gig mem. After logging in after rebooting, it takes 4 minutes to load Win mail. I used the "event Viewer" to see what was happening. It showed ESENT with ID 102--start Win mail, then the next event is ESENT ID 103 4 minutes later--terminate Win mail. Anyone have a clue why it is taking Win mail so long to load? Win mail works fine after computer loads. Fred Dwight Fred wrote: > Running Windows Vista Home Premium on Lenovo Laptop 2 gig mem. After > logging in after rebooting, it takes 4 minutes ...

Need help designing XML Dataset
Hello I developed and tested a web application using VS.NET 2003, VB, .NET Framework 1.1.4322, ASP.NET 1.1.4322 and IIS5.1. It uses a web form. I tried doing this without any help, but i'm getting nowhere. I want to create an XML schema (XSD) for a dataset/datatable using the XML designer. I want to be able to have a table for each trip. The trip will contain a trip no, date etc. But i also want it to have a State element like "PA, NJ, MD" for each state with miles traveled for each state. I don't want to enter 50 elements name MilesPA, MilesNJ, MilesMD etc. Is t...

stop extra spaces in text? Word xp. formated font/para ok
I'm using a C.V. template, word xp 2003, when I press the space bar, the whole text moves, and I cannot correct this. I've tried font and paragraph formatting. It's now happening in another template, sometimes I add a word, and again the text spaces increase ruining the document. I would be very grateful for any help. I need to get my C.V. in the post asap, but I've opened word, and am trying to copy/paste into it as a last resort. HELP! Kind Regards, What do you mean by "the whole text moves"? What "text spaces" increase? On Apr 27, 11:20...

Maximum Open Rows read only?
Hi, Is there a way to se "Maximum Open Rows" so I can set CacheSize of a recordset? Now it is 1 and Acess says it is Read Only. Thanks. ...

ReadXml to read recurring occurences of same tag?
Hello, I have an xml file with the following snippet: ....... some tags <ListItems> <item> 1 </item> <item> 2 </item> <item> 3 </item> </ListItems> I need to populate a dataset containing a table with one column "Item" with rows containining data from the item tag....i.e. 1,2,3. if i Create a DataTable named "ListItems" and a column element in it named "item" then only the first value is read. if i Create a DataTable named "item" then no values are read bu...

GetXml from DataSet
Hello, I transfer data from a dataset to an XML-document by using the GetXml-method in VB.NET. I noticed, that for datafields, which are empty (have no content) in the dataset, no elements are created in the XML-document. How can I force to generate elements (with no content) for this kind of datafields ? Thanks em Check out http://www.topxml.com/sqlxml/default.asp It has some excellent information on this. Regards Keith Chadwick "em" <nix@nix.nix> wrote in message news:018f01c3ba37$e4b0b760$a001280a@phx.gbl... > Hello, > I transfer data from a dataset to an XML...

Read Only Files in Mac
I regularly copy spreadsheets from a PC to Mac via CD burn The files always copy as read only, which means that I have to open & resave individually on the Mac This is easy to fix in explorer on the PAC but I cant work out how to change the read-only setting on the Mac. Any ideas Thanks, Kaval Hi this is probably not an Excel question but related to copying files from a CD -- Regards Frank Kabel Frankfurt, Germany Kaval wrote: > I regularly copy spreadsheets from a PC to Mac via CD burn. > > The files always copy as read only, which means that I have to open & > res...

xml and dataset
I want to take a dataset and save the data as an xml document. I know how to do this, but I need the xml to be formatted in a certain way. What are my options? I have thought about using a stylesheet to format from xml to xml. I can create an xsd, but that does not seem to save the dataset the way I need it. It just adds the schema to the top, but does not put the xml in a hierarchical format. TypedDataSet.WriteXml("C:\Test.xml", XmlWriteMode.WriteSchema) Hi Ken, You can do it using the XMLdoc. Because I do not know what you are reformating it is difficult to say more. Cor...

Any way to load VB persistence in C++?
I've re-written an old VB6 ActiveX control in C++ as a COleControl, duplicated all its properties and functionality, and taken over its old CLSID and ProgID. Now I'm looking for a way to load the old persisted properties in the new C++ control. Our container supports an ASCII persistence mode which implements IPropertyBag. In this mode, the properties that the VB control wrote out via PropertyBag.WriteProperties map right in to my new control's DoPropExchange PX_blah methods. In binary mode though, when CreateControl( ) winds its way down to my DoPropExchange, all the PX_blah me...

experts: structure of dataset xml
hello, i have a problem, i wonder if anyone can help... i am retrieving records from an access table using a dataset and want the data to be returned in xml, so i am using the dataset.GetXml() method. lets say, for example, that the xml is in the following format: <Users> <User> <UserId>1</UserId> <Username>robert</Username> <Password>friend</Password> </User> <User> <UserId>2</UserId> <Username>natasha</Username> <Password>sunny</Password...

deleting spaces
In a column of cells, tha majority of cells have spaces before the text. As there are over 500 cells, is there any easy way to delete these spaces? As there are spaces in between words within these cells, I don't want to delete all spaces, but just the first one which comes in front of the text. Hi Continental............, Suggest using the TRIMALL macro http://www.mvps.org/dmcritchie/excel/join.htm#trimall And if you got the material from an HTML page then they probably are CHAR(160) nonbreaking space (&nbsp;) rather than actual spaces Char(32), both of which are covered i...

Method 'Add' of object 'CommandBarControls' failed
I have encountered a problem with an Commercial Addin program by J-Wal and Associates "PUP2000". I have used this Addin for years and hav never had a problem with it, ever. I also have a fine addin by Ron d Bruin "Google 6.0" which is great. The reason I mention both of thes addins is because Ron's Google 6.0 is working fine, but John's (Joh Walkenbach) PUP2000 menu does not load at all when I start Excel. Ron' Google 6.0 does get added but perhaps it's because Ron's product onl adds an item to the existing Help menu. The actual error message tha shows ...

XslCompiledTransform.Transform() method question
VS2005; .NET 2.0 I want to use the XslCompiledTransform.Transform() method for its stated purposes. However, I have an XmlDocument object already in memory and I can't figure out how to use that without first saving it to disk and then referencing that file in the Transform() method. xslt.Load("MyXSLfile.xslt"); XMLdoc.Save("XSLTtransform.xml"); xslt.Transform("XSLTtransform.xml", "XSLTtransform.htm"); String XMLtransform = File.ReadAllText("XSLTtransform.htm"); Now I have my transformed XML into HTML string and can put it in my ...

How do I read an XmlDocument object into a dataset???
I need to read an in-memory instance of a loaded XmlDocument into a referenced DataSet. What's the best way to do this? I've tried "myDataSet.ReadXml(myXmlDocument)" but it won't compile. I get a compile error because the XmlDocument type isn't accepted by the ReadXml() method. I need to figure this out! Thanks, ~A~ Blah - nevermind. I don't need the xmldocument - I just feed the xml stream straight into the dataset. Thanks, ~A~ "Kewlpack" wrote: > I need to read an in-memory instance of a loaded XmlDocument into a > referenced DataSet....