Click here to Skip to main content
15,887,027 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
Headid HeadName Flag
1 Personaldata 0
2 Dependentdata 0
3 Risk Tolerance 0
11 Personal data 1

12 Dependent data 2

30 Risk TOlerance 3

flag = 0 means parents
Personal data have child Personal data
flag showing.(flag=1)
my window application in c# i have one textbox and save button.
when i click the save button .
my windows forms i have combobox and Textbox .
and save button
in the combobox i have bind the tblhead with ids and name.
when i entered the value in the Textbox it should be go tblhead.
when i seleted the from combobox Asstes(Parent) and enter the Personal Asstes(child) in Textbox
it should go to tbl head with flag means anything i entered into the texbox it show go his parent in table
showing by Flag
Posted
Updated 29-Feb-12 22:35pm
v9
Comments
Shahin Khorshidnia 29-Feb-12 4:52am    
Hello.
And sorry, I didn't understand your exact intention. Maybe my english is bad!

Let's review your question and please correct my errors:

You have a TextBox. (or many TextBoxes?!)
And you have a table in database .
you want to show relationship.
You want to enter some data in TextBoxes like Name, Child Name and etc. Ok?

But I don't know what the problem is.
1. You don't know how to store the values of the TextBoxes in database?
2. You don't have any idea about creating the necessary table in database?
3. Other.

Please clear up the matter.
Thank you.
Sergey Alexandrovich Kryukov 29-Feb-12 23:40pm    
It's better to ask a question from a different point of view: how hierarchical data got in the text box in first place? Why not using something structural (TreeView, for example)?

Otherwise it's called "create difficulties for yourself, to have something to bravely overcome". :-)
--SA
Shahin Khorshidnia 1-Mar-12 6:01am    
Agreed!

1 solution

Sorry again.

May I suggest another working method?

1. In your database:

have a Table (for example Person)
Person:
ID        BigInt        (PK)
Name      NVarChar(50)  
...
Node_ID   BigInt        (FK)


Node_ID refers to ID
If Node_ID = Null then It means the record is a RootNode.

For example:

1---John Smith--------Null
2---Sara Smith--------1
3---Martha Harrison---Null
4---Fred Cooper-------Null
5---Bill Jones----------3

it means:
"Sara Smith" is the child of "John Smith"
"Bill Jones" is the child of "Martha harrison"
"John", "Martha" and "Fred" are roots.

You can measure it and find persons and their relations with recursive method.

http://stackoverflow.com/questions/1005761/find-lowest-common-parent-in-recursive-sql-table[^]


2. In your WinForm:
For showing, as SA say, use something structural, for example: TreeView.
It's nice to show relation between child and parent.


http://msdn.microsoft.com/en-us/library/system.windows.forms.treeview.aspx[^]

http://msdn.microsoft.com/en-us/library/aa287576(v=vs.71).aspx[^]
 
Share this answer
 
v2
Comments
Sergey Alexandrovich Kryukov 1-Mar-12 20:35pm    
Makes sense. (Thanks for crediting my comment.) My 5.
I wish OP would be more descriptive....
--SA
Shahin Khorshidnia 2-Mar-12 2:41am    
Thank you SA :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900