473,327 Members | 1,979 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,327 software developers and data experts.

built treeview from SQLSERVER Database

Hello Everybody,

I am new to .NET.
I need to build a treeview which must be populated from SQL Server
Database.
I tried to my level best,but couldnt find a solution for it.

I have a table called mn_doc_master.

doc_id int
cat_id int
short_title char(20)
doc_type char(1)

I need to populate the treeview based on this table.
cat_id is a category.
short_title is the text to appear on the node.
doc_type mentions wheather the current document is a folder or
document.

i have values like

1,0,'1st Folder','F'
2,1,'1-1 Document','D'
3,1,'1-2 Document','D'
4,0,'2nd Folder','F'
5,4,'2-1 Folder','F'
and so on...

I need to build a tree based on these values..it should be in
heirarchial manner like

1st Folder
1-1 Document
1-2 Document
2nd Folder
2-1 Folder
2-1-1 Folder
and so on..

I tried the following way.
----------------------------------------------------------------------------
Dim daDocs As New SqlClient.SqlDataAdapter("SELECT
short_title,doc_id,cat_id FROM mn_doc_master ORDER BY cat_id.doc_id ",
myConnection)

daDocs.Fill(objDS, "dtDocs")

Dim nodeDoc, nodeCat As TreeNode
Dim rowSupp, rowProd As DataRow

For Each rowSupp In objDS.Tables("dtDocs").Rows
nodeDoc = New TreeNode
nodeDoc.Text = rowSupp("short_title")
nodeDoc.ID = rowSupp("doc_id")
Dim cat_id = rowSupp("cat_id")
Treeview1.Nodes.AddAt(cat_id, nodeDoc)
Next
------------------------------------------------------------------------------

Thanks in Advance,
Nov 18 '05 #1
0 1010

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Bart Torbert | last post by:
Hello, I am starting to examine using SQLServer instead of Oracle. I went through the SQLServer import utility to copy tables from Oracle into SQLServer. I then checked the size of the...
1
by: dave | last post by:
What is the most effecient method to take data from a database table (sqlserver) to a vb.net treeview control. The database table looks like ID, Name, ParenetID 1 , test, <null> 2, test2, 1...
3
by: Devonish | last post by:
I am planning to convert an existing Access database which has a back end (data tables and relationships only) on a server and a copy of the front end (form, queries, reports) on each of about a...
14
by: Roy Gourgi | last post by:
Hi, I need to store and retrieve information from a database. It looks as though there is a lot more support for SQLServer than there is for Access, correct me if I am wrong. What do I have...
0
by: Jaidev Paruchuri | last post by:
Hello Everybody, I am new to .NET. I need to build a treeview which must be populated from SQL Server Database. I tried to my level best,but couldnt find a solution for it. I have a table...
4
by: Danny W | last post by:
Hi There! Is it possible to use HttpModule to replace the built-in ASP.NET Session object? I want to write a HttpModule that will handle storing and retrieving of session values from an external...
3
by: Jan Wrage | last post by:
Hi! I would like to implement a treeview in my existing application. It should show my entire Active-Directory structure, i.e. all Groups, Containers and OUs. Could somebody help me with...
7
by: vsiat | last post by:
I am trying to create a treeview out of a database table with the typical structure ID, NAME, PARENTID, TYPE, EXTRA_INFO, where is linked to the . What I want to achieve is create a tree made...
3
by: babu17 | last post by:
hi , I have a database table with 3 columns table1: eid ename parentid 0 root 0 1 child1 0 2 child2 0
2
by: makennedy | last post by:
Hi Experts, Please help, I am a newbie to ASP.NET 2.0 may be I am doing something wrong or there may be a bug somewhere. Basically I have a TreeView Control which I have created...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.