By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,876 Members | 1,239 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,876 IT Pros & Developers. It's quick & easy.

Reading XML direct from SQL

P: n/a
Hi,

I'm not sure if this is possible, I can't see why, but is there a way round
a problem I have.

I'm returning the results from a stored procedure, of which there could be
anything from 5 to 1000 records. The results have simply 3 columns (parent,
level, name), although this could increase in time to show more information.

I also have a treeview, of which I'd like to bind this data to, and I've
read that I can use an XML that is bound to the treeview, and the treeview
is geneerated from it.

The trouble is, the documentation says that in order to bind the control to
the XML file, I need to tell it where the XML file is. I don't want to have
an XML file held locally on the machine.

Is there a way to copy the sql generated results (easy), into a
dataset/dataview (easy), and convert this dataset into an XML document in
memory, and attach this to the datagrid?

Or, does anyone have a better solution as to how to achieve this?

TIA
Nov 11 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
datagrid, treeview,
can you show some code that would illustrate what you are trying to do and
where?

Which treeview - is that asp.net or windows forms?
where is the datagrid - aspx or winforms?

what is the core problem here?
you know how to get XML from SQL (you said "easy").
so....
what's the problem?
"Jason Hirst" <ja*********@hotmail.com> wrote in message
news:eB**************@TK2MSFTNGP12.phx.gbl...
Hi,

I'm not sure if this is possible, I can't see why, but is there a way round a problem I have.

I'm returning the results from a stored procedure, of which there could be
anything from 5 to 1000 records. The results have simply 3 columns (parent, level, name), although this could increase in time to show more information.
I also have a treeview, of which I'd like to bind this data to, and I've
read that I can use an XML that is bound to the treeview, and the treeview
is geneerated from it.

The trouble is, the documentation says that in order to bind the control to the XML file, I need to tell it where the XML file is. I don't want to have an XML file held locally on the machine.

Is there a way to copy the sql generated results (easy), into a
dataset/dataview (easy), and convert this dataset into an XML document in
memory, and attach this to the datagrid?

Or, does anyone have a better solution as to how to achieve this?

TIA

Nov 11 '05 #2

P: n/a
I am not sure I understand your question (DataGrid binds directly to
DataSet), but there is an easy way to convert a DataSet to a XmlDocument in
memory by using XmlNodeWriter (see
http://gotdotnet.com/Community/UserS...5-1FC569CDE11C
or search for 'XmlNodeWriter Chris Lovett' in you favorite search engine)

HTH,
Daniel D.C.

--
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm.
"Jason Hirst" <ja*********@hotmail.com> wrote in message
news:eB**************@TK2MSFTNGP12.phx.gbl...
Hi,

I'm not sure if this is possible, I can't see why, but is there a way round a problem I have.

I'm returning the results from a stored procedure, of which there could be
anything from 5 to 1000 records. The results have simply 3 columns (parent, level, name), although this could increase in time to show more information.
I also have a treeview, of which I'd like to bind this data to, and I've
read that I can use an XML that is bound to the treeview, and the treeview
is geneerated from it.

The trouble is, the documentation says that in order to bind the control to the XML file, I need to tell it where the XML file is. I don't want to have an XML file held locally on the machine.

Is there a way to copy the sql generated results (easy), into a
dataset/dataview (easy), and convert this dataset into an XML document in
memory, and attach this to the datagrid?

Or, does anyone have a better solution as to how to achieve this?

TIA

Nov 11 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.