文本框和combox,其中包含hirhirarchy数据到sql [英] textbox and combox with hirearchy data to sql

查看:73
本文介绍了文本框和combox,其中包含hirhirarchy数据到sql的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Headid HeadName标志
1个人资料0
2 Dependentdata 0
3风险承受力0
11个人资料1

12相关数据2

30风险承受力3

标志= 0表示父母
个人资料有孩子个人资料
标志显示.(flag = 1)
我在C#中的窗口应用程序有一个文本框和保存"按钮.
当我单击保存"按钮时.
我的Windows窗体有combobox和Textbox.
并保存按钮
在组合框中,我已将tblhead与ID和名称绑定.
当我在文本框中输入值时,应该转到tblhead.
当我从组合框Assets(Parent)中选择了"the",并在Textbox中输入Personal Asstes(child)
时 它应该以tbl开头并带有标志,这意味着我输入到texbox中的所有内容都显示在表中的父项中.
再次由Flag

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

推荐答案

显示.

我可以建议另一种工作方法吗?

1.在您的数据库中:

有一张桌子(例如人)
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_IDID
如果Node_ID = Null,则表示记录是RootNode.

例如:

1 ---约翰·史密斯--------空
2 ---萨拉·史密斯-------- 1
3 ---玛莎·哈里森(Martha Harrison)---空
4 --- Fred Cooper -------空
5 ---比尔·琼斯(Bill Jones)---------- 3

表示:
萨拉·史密斯"是约翰·史密斯"的孩子
比尔·琼斯"是玛莎·哈里森"的孩子
"John","Martha"和"Fred"是根.

您可以对其进行度量,并使用递归方法查找人及其关系.

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


2.在您的WinForm中:
如SA所说,要进行显示,请使用一些结构化的东西,例如:TreeView.
很高兴显示孩子与父母之间的关系.


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

http://msdn.microsoft.com/en-us/library/aa287576 (v = vs.71).aspx [



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[^]


这篇关于文本框和combox,其中包含hirhirarchy数据到sql的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆