یه سمپل پیدا کردم.
جدول Acc_Group < ID_Group - Name_Group
جدول Acc_Koll > ID_Koll - ID_Group - Name_Koll
کد ارتباط
private void button1_Click(object sender, EventArgs e) {
OleDbConnection con = new OleDbConnection(ConnectionString);
con.Open();
DataSet ds = new DataSet();
OleDbDataAdapter adapter1 = new OleDbDataAdapter();
OleDbDataAdapter adapter2 = new OleDbDataAdapter();
string text1 = "Select ID_Group,Name_Group from Acc_Group";
string text2 = "Select ID_Group,Name_Koll from Acc_Koll";
new OleDbDataAdapter(text1, con).Fill(ds, "Acc_Group");
new OleDbDataAdapter(text2, con).Fill(ds, "Acc_Koll");
ds.Relations.Add("GroupToKoll", ds.Tables["Acc_Group"].Columns["ID_Group"], ds.Tables["Acc_Koll"].Columns["ID_Group"]);
foreach (DataRow row1 in ds.Tables["Acc_Group"].Rows)
{
TreeNode node1 = new TreeNode();
node1.Text = row1["Name_Group"].ToString();
treeView1.Nodes.Add(node1);
foreach (DataRow row2 in row1.GetChildRows("GroupToKoll"))
{
TreeNode node2 = new TreeNode();
node2.Text = row2["Name_Koll"].ToString();
node1.Nodes.Add(node2);
}
}
}
چطوری میتونم تو در تو ترش کنم
مثلا به String یه بخش اضافه کنم