Developer .NET UPDATE—brought to you by the Windows & .NET Magazine Network
THIS ISSUE SPONSORED BY
Microsoft ASP.NET Connections
Windows & .NET Magazine LIVE!
(below DEVELOPER .NET PERSPECTIVES)
SPONSOR: MICROSOFT ASP.NET CONNECTIONS
EARLY BIRD DISCOUNT EXPIRES SEPTEMBER 20
FOR LARGEST .NET DEVELOPER EVENT
More Sessions, Top Quality, Unbeatable Value
DevConnections Conferences provide more sessions at a lower cost than other events focused on Microsoft technologies.
Register today for either Microsoft ASP.NET Connections, VS.NET Connections, or SQL Server Magazine LIVE! and you'll get access to over 160 sessions and save $2,990—but only if you act right now as the Early Bird Discount expires September 20.
This deal gets even better: Stay for the whole week and save $4,985 when you also register for either Windows & .NET Magazine LIVE! or XML Web Services Connections. Register for the whole week and you'll get access to five conferences and over 240 sessions! Click now before this offer expires:
September 17, 2002—In this issue:
1. DEVELOPER .NET PERSPECTIVES
- Persisting Data Sets—Which Method Is Right for You?
- Mark Minasi and Paul Thurrott Are Bringing Their Security Expertise to You!
- New! News, Tips, and More to Keep Your Network Humming
- Featured Thread: The .NET Framework and WTS
4. NEW AND IMPROVED
- Use a Free .NET GUI Library to Develop Applications
5. CONTACT US
- See this section for a list of ways to contact us.
1. DEVELOPER .NET PERSPECTIVES
(contributed by Marquis Howard, email@example.com)
I recently had to develop supplemental code for an existing application. To create this supplement, I needed to use existing data-access methods that returned two data sets from a Microsoft SQL Server database. The database was large, so copying it onto my machine wasn't an option. And I didn't want to use a VPN connection to access the database because I sometimes work at the park or library. Microsoft .NET Framework came to the rescue. By using the .NET Framework, all I needed to have on my machine was the two data sets.
If you've worked with data sets in the .NET Framework, you're probably familiar with the DataSet class's WriteXml method. This method has several different Overload options from which to choose. In my case, I needed to use the String option to write the data set to a specified XML file.
After I used the WriteXml method to write the data sets to an XML file on my laptop, I used the DataSet class's ReadXml method to read the data back into a data set. However, the results weren't what I expected. Here's a sample of the data set after I read back the data:
I needed only the value between the
My next step was to save the original data set, write the contents to an XML file, then immediately read the data back into the original data set. In doing so, I noticed a different structure. Here's a sample of that data set:
As you can see, the 88 value is missing entirely and the inner
Revisiting the Microsoft Developer Network (MSDN) documentation for the WriteXml method, I discovered an additional parameter called XmlWriteMode. This parameter specifies how to write the data to the XML file. You can choose one of three modes: WriteSchema, IgnoreSchema, and DiffGram. When you use the WriteSchema mode, the WriteXml method not only writes the data set's contents as XML data but also includes the data set's relational structure as inline XML Schema Definition (XSD) schema. If you want to write the data set's contents but not the schema, you use the IgnoreSchema mode. (The results of using this mode are the same as if you use the WriteXml method without the optional XmlWriteMode parameter.) The DiffGram mode writes the data in the DiffGram format. For information about this format, see Dino Esposito's Web-exclusive article "The DiffGram Format," InstantDoc ID 23901, which you can find on the SQL Server Magazine Web site:
I wanted to include the schema, so I set the XmlWriteMode parameter to WriteSchema. I received these encouraging results:
For my next test, I wanted to read the schema into the data set before adding the XML data. Although you can use the ReadXml method to read in only the data or read in both the schema and the data, you can't use the ReadXml method to read in only the schema. That task is the job of the DataSet class's ReadXmlSchema method. One of this method's parameters is the XML file to read.
After I used the ReadXmlSchema method to read the schema into the data set, I used the ReadXml method to read in the data. When I looped through each row of the data set, I saw that all the data was present. I finally had the data sets I needed to work offline.
The DataSet class is robust and provides many methods with which to manipulate data. However, be aware that reading XML data into a data set has some caveats. The main one is that the XML data needs to be well formed. You can find out more information about the WriteXml, ReadXml, and ReadXmlSchema methods at the following URLs:
If the structure of your data isn't going to change and you need a particular portion of data from a data source, you can take advantage of the WriteXml, ReadXml, and ReadXmlSchema methods to create data sets. These methods let you persist the data you need without having to copy the entire database on your machine. The resulting data sets are ideal for use when you want to work offline or you want to demonstrate programs during presentations.
SPONSOR: WINDOWS & .NET MAGAZINE LIVE!
WINDOWS & .NET MAGAZINE LIVE! EARLY-BIRD DISCOUNT EXPIRES FRIDAY
Real-World Tips and Solutions Here for You
Register now for Windows & .NET Magazine LIVE! and take advantage of early-bird savings! This conference is chock full of "been there, done that" information from people who use Microsoft products in the real world. Increase your productivity with shortcuts, tips, and tricks you'll learn only at Windows & .NET Magazine LIVE! Solve those tough interoperability issues, enhance systems administration with new tools, and learn how .NET will impact your job. Benefit from our mix of speakers representing magazine authors, Microsoft architects, and other third-party gurus. This must-attend event is loaded with practical information you can use right away to help keep your skills sharp.
Register now to lock in your early-bird savings! You'll also receive FREE access to sessions of concurrently run XML Web Services Connections. Go to:
(brought to you by Windows & .NET Magazine and its partners)
Windows & .NET Magazine Network Road Show 2002 is coming this October to New York, Chicago, Denver, and San Francisco! Industry experts Mark Minasi and Paul Thurrott will show you how to shore up your system's security and what desktop security features are planned for Microsoft .NET and beyond. Sponsored by NetIQ, Microsoft, and Trend Micro. Registration is free, but space is limited so sign up now! http://www.winnetmag.com/seminars/roadshow
Networking UPDATE brings you the how-to tips and news you need to implement and maintain a rock-solid networking infrastructure. We'll explore interoperability solutions, hardware (including servers, routers, and switches), network architecture, network management, network security, installation technology, network training, and WAN disaster recovery. Subscribe (at no cost!) at
A forum member wants to know whether the Microsoft .NET Framework works with Windows NT Server 4.0, Terminal Server Edition (WTS). If you know, go to
4. NEW AND IMPROVED
(contributed by Sue Cooper, firstname.lastname@example.org)
Crownwood Consulting released Magic Library 1.7, a GUI library that expands on the Microsoft .NET Framework's basic look and feel. This library is for .NET developers who want to improve the appearance of their applications and who want to learn how to get the most from Windows.Forms by examining the code. You can use Magic Library from any managed .NET language. The library comes with full source code, sample applications, documentation, and a signed assembly. You can include the Magic Library in your private or commercial applications free of charge. Full license terms are in the readme.html file that you download. Contact Crownwood Consulting at email@example.com.
5. CONTACT US
Here's how to reach us with your comments and questions:
- ABOUT DEVELOPER .NET PERSPECTIVES — firstname.lastname@example.org
- ABOUT THE NEWSLETTER IN GENERAL — email@example.com
(please mention the newsletter name in the subject line)
- TECHNICAL QUESTIONS — http://www.winnetmag.net/forums
- PRODUCT NEWS — firstname.lastname@example.org
- QUESTIONS ABOUT YOUR DEVELOPER .NET UPDATE SUBSCRIPTION?
Customer Support — Developer_dot_NET_update@winnetmag.com
- WANT TO SPONSOR DEVELOPER .NET UPDATE?
This weekly email newsletter is brought to you by Windows & .NET Magazine, the leading publication for Windows professionals who want to learn more and perform better. Subscribe today.
Receive the latest information about the Windows and .NET topics of your choice. Subscribe to our other FREE email newsletters.
Thank you for reading Developer .NET UPDATE.