473,396 Members | 2,037 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,396 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 1013

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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.