Link related problem

I want to know that when we link node like the scrinshot
Database has a table:
NEW TABLE: provision_link
provision_id INT
provision_id_begin INT
provision_id_end INT

provision_id_begin : 1
provision_id_end : 2
provision_id_begin : 2
provision_id_end : 3
provision_id_begin : 3
provision_id_end : 4
Then I want to PICK PROVISION_ID from the Table
Please provide sample like this.

I don’t understand your sample data. Are the begin/end supposed to be Node IDs, and the provision_id is the link id? (ie. Link with Provision ID 20 links begins at Node 1 and ends at Node 2.)

Did you mean to have PROVISION_IDs of 21 and 22 for links 2->3 and 3->4?

Hi Jake,

we have a table in databese name provision_link this table have three column: and suppose value is
2.provision_id_begin: 1
3.provision_id_end : 2
I want to know that when we link node1(which provision_id_begin=1) and node2(Which provision_id_end=2) with another node( Link node which PROVISION_ID=20)) then PROVISION_ID of link node should be pick automaticall from the table provision_link
If possible please provide sample because its very urgent.

OK, I think you’re asking how do you iterate the tables to create the nodes and links…

NodeID Label
1 Node 1
2 Node 2
LinkID Begin End
20 1 2
so, the code will be (treating all the data as strings here for simplicity)
foreach(DataRow row in NodesTable.Rows) {
CreateNode(row["nodeid"], row["label"]);
I'll leave writing CreateNode to you...
and for links
foreach(DataRow row in NodesTable.Rows) {
string beginNodeID = row["begin"];
string endNodeID = row["end"];
MyNode begin = FindNode(beginNodeID);
MyNode end = FindNode(endNodeID);
CreateLink(row["linkid"], begin, end);
method "FindNode" is also up to you, depending on how you would find the nodes by NodeID.
The DataSetDemo sample uses a HashTable of nodes to track the nodes created, then uses the HashTable to look up the GoNodes when creating the links. (actually DataSetDemo uses a hash for "from" nodes and a hash for "to" nodes, but if you look at the call to CreateLinksFromDataSetTable, you'll see it is passing in the same hash table for both "from" and "to").
My apologies if I didn't understand the question....

Hi Jake,
This code is not working so If possible please send a sample like this.

That was meant to be pseudo-code. not something you could plug in and run. I don’t know the structure of your database, so it wouldn’t be possible for me to do that.

Hi Jake,

My problem is related to just like a your sample project DataSetDemo.
I have a table , that structure is
Provision_id int ;
provision_Id_begin int;
Provision_id_end int;
In that that the data is :
Provision_Id Provision_Id_Begin Provision_Id_End
20 1 2
20 2 3
20 3 4
I want to impliment just like a connecter between the begining node and end node between the two node.
For Example the "1" is provision _id _Begin of "Node 1" and "2" is provision_Id_End of "Node2" and I want to display "Node 1" and "Node 2" are connected by a N/w element L20. where L means "Link".
I have sumitted the Image related to this previously.
Is this feature possible in DataSetDemo application. I am not able find out where I have to write code for implement this feature.
It is very urgent.

I don’t understand how one link (L20) can link 3 separate pairs of nodes…

Your image looks like a representation of the first row of data, but I don't understand how L20 also connects nodes 2 -> 3 and 3 -> 4.

Hi Jake,
We do not want to link 3 node.We just want to link only 2 node with the help of (L20) .

So go back and read what I wrote on Dec 6. You need 2 tables: 1 for Nodes, and 1 for links.

DataSetDemo only has 1 table, because the nature of the tree it is building only ever needs one link per node, and it embeds the name of the parent node in the single table.
DataSetDemo calls CreateNodesFromDataSetTable and CreateLinksFromDataSetTable separately, but uses the same table for both calls.
dsMapper.CreateNodesFromDataSetTable(protoNode, "Employees", "ID");
// Create the links, also from the "Employees" table
dsMapper.CreateLinksFromDataSetTable(protoLink, "Employees", "ID", "Boss", "ID", "Employees", "Employees");
so, if you had a separate table for links (which it appears your app needs)
dsMapper.CreateNodesFromDataSetTable(protoNode, "NodeTable", "ID");

dsMapper.CreateLinksFromDataSetTable(protoLink, "LinksTable", "Provision_ID", "Provision_Id_Begin", "Provision_Id_End", "NodeTable", "NodeTable");
(side note... in the header for CreateLinksFromDataSetTable, there is a comment that reads:

/// The name of the column that contains a unique node ID.
it should read:
/// The name of the column that contains a unique LINK ID.)