SQL SERVER Table to XML

M

Mick Walker

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
PlacementBelowID int Unchecked
DisplayComments bit Checked



Basically If an Item has a PlacementBelowID 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.VisualBasic
Imports Microsoft.ApplicationBlocks.Data
Imports System.Data.SqlClient
Imports System.Collections.Generic

Namespace Keywords
Public Class Keywords

Private _KeywordIndexID As Integer
Private _Keyword As String
Private _PlacementBelowID As Integer
Private _DisplayComments 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 PlacementBelowID() As Integer
Get
Return _PlacementBelowID
End Get
Set(ByVal value As Integer)
_PlacementBelowID = value
End Set
End Property


Public Property DisplayComments() As Boolean
Get
Return _DisplayComments
End Get
Set(ByVal value As Boolean)
_DisplayComments = value
End Set
End Property
End Class
End Namespace
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,822
Latest member
israfaceZa

Latest Threads

Top