Gizmox Sample applications - NorthWind Database as XML
From Visual WebGui Wiki
| This article will have a few sections added to it soon, based on the following article type skeleton: NewCodeSampleTemplate |
Contents |
Overview
The NorthWind sample database, supplied by Microsoft, is very often used in code samples to save the developer the time it takes to create sample data. When sending sample applicatons to Gizmox's support, it is requested that if database connection is required for the application, to have it connect to the NorthWind sample database.
At times, this is not a practical requirement. Some developers don't even have access to MS SQL server, which is required to fullfill this requirement.
This article will present an alternate solution, giving you access to all the data from NorthWind, without any database connection.
The solution has been enclosed in a Visual WebGui application which you can use as a skeleton for how you would access the NorthWind data.
What has been done
The database schema information for NorthWind has been extracted and is included in the application in the form of a ADO.NET dataset.
The NorthWind data has also been extracted to an XML file, included within the application.
A new overloaded constructor has been added, that accepts a name of an XML file that contains the data.
How do I use it
First, you need to copy the NorthWind.xsd and accompanying files from the demo application into your own application.
Next, you need to copy the NorthWindData.XML file and add it to your own application. The physical location of this file matters, but can be changed. In the demo app it is expected to be directly on the application folder.
Finally, you simply use the new constructor to create an instance of your dataset and load it with all the xml data.
VB.NET Code
Dim NW As NorthWind = New NorthWind("~\NorthWindData.XML")
C# Code
NorthWind NW = new NorthWind("~\\NorthWindData.XML");
The demo application and the data
The demo application is supplied both in VB.NET and C# code and can be downloaded from
here
