How to populate a TreeView from a SQL Server Database with SQL Query & Print in Crystal Report in VB.NET

StackOverflow https://stackoverflow.com/questions/17602697

  •  02-06-2022
  •  | 
  •  

Question

I am learning the VB.NET programming language and am making a Membership application. I have never used a TreeView before and wanted to know how one goes about populating the tree items from a database. I am using Visual Studio 2008 and Microsoft SQL Server 2005.

SQL Server Table - MemberMaster

MemberID, MemberName,   Rank,   SponsorID,   SponsorName
10012     Alex Con      16      10001        Company      
10062     Jhon Smith    15      10012        Alex Con
11067     Rotia Shiva   12      10062        Jhon Smith
10089     Mark Saveg    12      11067        Rotia Shiva
12058     Senno Maro    08      11067        Rotia Shiva
12059     Dilson Rako   10      11067        Rotia Shiva
12060     Mirak Kan     10      11067        Rotia Shiva
12061     Bikash Mahata 07      12059        Dilson Rako
12062     Vijoy Singha  06      12059        Dilson Rako

I have a VB Form where I can put the MemberID and Click on Show Button to Populate the TreeView as follows:

e.g If I put MemberID 11067

Rotia Shiva (ID-11067)(Rank-12)
........Dilson Rako(ID-12059)(Rank-10)
................Bikash Mahata(ID-12061)(Rank-07)
................Vijoy Singha (ID-12062)(Rank-06)
........Mirak Kan(ID-12060)(Rank-10)
........Senno Maro(ID-12058)(Rank-08)

After that I want to print the populated TreeView.

Was it helpful?

Solution

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top