BizTalk Utilities CV ,   Jobs ,   Code library
 
Home Page


Add/Edit your code items
Search the code library
Browse for the code library


XQuery
Learn XQuery 1.0 fundamentals


 
 

<< XmlSerializerXSLT >>


By Mark Wilson
I am the creator of TopXML. I am available for international and local (Australia) contracts. I am a Solution Architect/Business Analyst. I have worked in IT in several countries (NZ, Australia, South Africa, UK) building and training teams for government and very large non-governmental organizations. I am ex-Microsoft Consulting Services. I wrote the first book on Microsoft XML published in 2000 called XML Programming with VB and ASP. Most recently I have been building tools for the SEO industry. Ask me for a 37 point SEO health-checkup for your website.
First Posted 05/24/2002
Times viewed 588

How to use XQuery in ASP.NET


Summary This snippet shows how to use the MS XQuery managed classes in ASP.NET. The language used is C#.

Microsoft has developed a managed class set of XQuery 1.0 for use in their new .NET framework. Where to get them? This class set can be downloaded from http://131.107.228.20/xquerydemo/Setup/xquery.msi. What do I need to be able to install and use them? You should have installed the .NET Framework SDK RTM 1.0 before attempting to install the classes. This SDK can be downloaded from http://msdn.microsoft.com/downloads/default.asp?url=/downloads/sample.asp?url=/msdn-files/027/000/976/msdncompositedoc.xml&frame=true After having installed MSXQuery Demo, you can start to use them. First, you need to add a Reference to the assembly, Microsoft.Xml.XQuery.dll. You do this by selecting Project | Add Reference once you've created a new C# Web Application project called "MSXQDemoTopXML". Next, add a new Web Form called "MSXQDemo". Add a new DatGrid control to the design view and call it "gridMSXQ". Below is the complete code used in this page. Add ONLY the new code by replacing all necessary parts - do NOT replace everything as this could cause problems. A SQL Query Template is used here to get Customers data from the SQL Northwind database. To get it working, first install SQLXML 3.0, available from http://msdn.microsoft.com/downloads/default.asp?URL=/downloads/sample.asp?url=/msdn-files/027/001/824/msdncompositedoc.xml. You might also need to install the Microsoft SOAP Toolkit 2.0 SP2. Get it at http://msdn.microsoft.com/downloads/default.asp?url=/downloads/sample.asp?url=/msdn-files/027/001/580/msdncompositedoc.xml. When installed, open SQLXML's "Configure IIS Support" program and create a new virtual directory called "northwind". Then, create a subdirectory under your VS.NET project file and call it "xml". Point the Local Path of the virtual directory "northwind" to it. Fill in the Security and Datasource Tabs. The only thing left is to set up a virtual name for the templates - callt it "templates", the type is "template", and point it to a new subdirectory under "xml" called "templates". Click Apply and OK. Finally, create a template file with notepad and call it "Customers". Place it in the "xml\templates" subdirectory. The file should contain the following - see the XML code section. Now, test the SQLXML set up by requesting the following URL in your browser: http://localhost/northwind/templates/Customers.xml If this works, then you should be able to build and run the project by pressing F5 without problems.

Additional information

Further additional information


Rate this article on a scale of 1 to 10 (0 votes, average 0)

Your vote :  

<< XmlSerializerXSLT >>





Leave a comment for this article
Your name
Your email (optional)
Your comment
Optional: Upload an attachment
Enter the code shown:

 
 

    Email TopXML