SQL SERVER Table to XML

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Mick Walker

    #1

    SQL SERVER Table to XML

    Hi All,

    Just looking for a few pointers here. I have been giving the task of
    pulling a table from an SQL Server, to do this, I simply created a
    class, and return a List (of <class>). This all works fine, now what I
    wish to do is find a way to irritate through this list, and generate a
    XML file to be used with a treeview control. The database is very simple
    in structure, it only has 4 fields, so the number of passes required
    should be minimal.
    I know that SQL Server 2005 can provide data in an XML format, however
    this isn't an option as It would require 2 calls to the database, as
    more than one thing is actually being done with the data received.

    I do not know if this is valid or not, but I have included my Database
    design specs:

    KeywordIndexID int Unchecked (Primary Key)
    Keyword varchar(100) Unchecked
    PlacementBelowI D int Unchecked
    DisplayComments bit Checked



    Basically If an Item has a PlacementBelowI D of 4, then it is a subnode
    of the node with item 4 as the KeywordIndexID within the treeview.

    If anyone can offer me any pointers I would be most grateful.
    And if you need clarification on any thing I have stated here, please
    don’t hesitate to ask.

    Thanks



    P.s:

    I do not know if required, but my Class file is below

    Imports Microsoft.Visua lBasic
    Imports Microsoft.Appli cationBlocks.Da ta
    Imports System.Data.Sql Client
    Imports System.Collecti ons.Generic

    Namespace Keywords
    Public Class Keywords

    Private _KeywordIndexID As Integer
    Private _Keyword As String
    Private _PlacementBelow ID As Integer
    Private _DisplayComment s As Boolean

    Public Property KeywordIndexID( ) As Integer
    Get
    Return _KeywordIndexID
    End Get
    Set(ByVal value As Integer)
    _KeywordIndexID = value
    End Set
    End Property

    Public Property Keyword() As String
    Get
    Return _Keyword
    End Get
    Set(ByVal value As String)
    _Keyword = value
    End Set
    End Property

    Public Property PlacementBelowI D() As Integer
    Get
    Return _PlacementBelow ID
    End Get
    Set(ByVal value As Integer)
    _PlacementBelow ID = value
    End Set
    End Property


    Public Property DisplayComments () As Boolean
    Get
    Return _DisplayComment s
    End Get
    Set(ByVal value As Boolean)
    _DisplayComment s = value
    End Set
    End Property
    End Class
    End Namespace
Working...