Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > General .NET
|
General .NET For general discussion of MICROSOFT .NET topics that don't fall within any of the other .NET forum subcategories or .NET language forums.  If your question is specific to a language (C# or Visual Basic) or type of application (Windows Forms or ASP.Net) try an applicable forum category. ** PLEASE BE SPECIFIC WITH YOUR QUESTION ** When posting here, provide details regarding the Microsoft .NET language you are using and/or what type of application (Windows/Web Forms, etc) you are working in, if applicable to the question. This will help others answer the question without having to ask.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the General .NET section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 31st, 2004, 03:12 AM
Authorized User
 
Join Date: Oct 2003
Posts: 89
Thanks: 0
Thanked 0 Times in 0 Posts
Default xml/sql and asp.net

Hi,

I am trying to popluate skmMenu (www.skmMenu.com) from db on page.load:
[u]vb.aspx</u>
Dim custDA As SqlDataAdapter = New SqlDataAdapter("SELECT CATEGORYName as text,
categoryid as url FROM CATEGORIES", oconn)

Dim orderDA As SqlDataAdapter = New SqlDataAdapter("SELECT ModelName as text,
CATEGORYID as url FROM PRODUCTS", oconn)

oconn.Open()

Dim custDS As DataSet = New DataSet("menu")

custDA.Fill(custDS, "menuItem")

orderDA.Fill(custDS, "subMenu")

oconn.Close()

Dim custOrderRel As DataRelation = custDS.Relations.Add("CustOrders",
custDS.Tables("menuItem").Columns("url"),
custDS.Tables("subMenu").Columns("url"))

custOrderRel.Nested = True


' File paths

Dim strXsdPath As String = Server.MapPath("db_xml.xsd")

Dim strXmlPath As String = Server.MapPath("db_xml.xml")

'''' Write out schema to .xsd file and data to .xml file

custDS.WriteXmlSchema(strXsdPath)

custDS.WriteXml(strXmlPath, XmlWriteMode.IgnoreSchema)

'Bind to menu

Menu1.DataSource = Server.MapPath("db_xml.xml")

Menu1.DataBind()



--------- The resulting xml is as follows:

<?xml version="1.0" standalone="yes" ?>

- <menu>
- <menuItem>
<text>PARTS</text>
<url>51</url>
- <subMenu>
<text>YELLOW SLD002</text>
<url>51</url>
</subMenu>
</menuItem>
</menu>

<b>However, I want the resulting xml to be as follows and not as above and I am not
sure how to do it in code:</b>

<menu>
<menuItem>
<text>Parts</text>
       <subMenu>
          <menuItem>
              <text> YELLOW SLD002 </text>
         <menuItem>
      </subMenu>
</menuItem>
</menu>






Similar Threads
Thread Thread Starter Forum Replies Last Post
Relational SQL Data to XML - Vet SQL/ASP - New XML JimiTheJett XML 1 December 4th, 2008 06:06 PM
Xml from SQL Server into ASP.NET toddw607 ASP.NET 2.0 Basics 4 June 4th, 2007 08:57 AM
Parse XML doc using VB.NET into ASP.NET page kwilliams Classic ASP XML 17 November 11th, 2005 10:42 AM
xml/sql and asp.net collie XML 0 October 31st, 2004 03:10 AM
trouble shoot XML SQL ASP.net VB fzilz ADO.NET 1 April 7th, 2004 11:29 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.