Zhang 1 2 3
Zhang 2 5 6
3 wang 7 8 9
4 wang, 10, 11 12
5 li 13 14 15
6 li 123 2 4
Liu, 123 2 2
As above, the engineering project, engineering division, division project, subdivisional work by name points 4 to return to the treeview, repetitive project of recursion to the same node, ask for help!
Zhang
1
2
3
2
5
6
CodePudding user response:
For reference only
//-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Void __fastcall TMapFrm: : TreeView1Init ()
{
Try
{
Node1 TTreeNode * Root, * and * 2;
AnsiString TempStr SQLStr;
TreeView1 - & gt; The Items - & gt; The Clear ();
The Root=TreeView1 - & gt; The Items - & gt; AddChild (NULL, "the national highway system");
Root - & gt; SelectedIndex=0;
//Root - & gt; Selected=true;
DataMod - & gt; ProvinceADOQ - & gt; Close ();
SQLStr="Select * from ProvinceTable Where DeviceNum> Zero Order by ProvinceID ";
DataMod - & gt; ProvinceADOQ - & gt; SQL - & gt; Text=SQLStr;
DataMod - & gt; ProvinceADOQ - & gt; The Open ();
DataMod - & gt; ProvinceADOQ - & gt; The First ();
while(! DataMod - & gt; ProvinceADOQ - & gt; Eof)
{
TempStr=DataMod - & gt; ProvinceADOQ - & gt; FieldByName (" ProvinceID ") - & gt; AsAnsiString. SubString (3, 2);
TempStr +=DataMod - & gt; ProvinceADOQ - & gt; FieldByName (" ProvinceName ") - & gt; AsAnsiString;
//+ TempStr="(" + DataMod - & gt; ProvinceADOQ - & gt; FieldByName (" DeviceNum ") - & gt; AsAnsiString + ") ";
Node1=TreeView1 - & gt; The Items - & gt; AddChild (Root, TempStr);
Node1 - & gt; SelectedIndex=1;
DataMod - & gt; WaysADOQ - & gt; Close ();
SQLStr="Select * from waysTable where ProvinceID=";
SQLStr +=DataMod - & gt; ProvinceADOQ - & gt; FieldByName (" ProvinceID ") - & gt; AsAnsiString;
SQLStr +="order by highwayID";
DataMod - & gt; WaysADOQ - & gt; SQL - & gt; Text=SQLStr;
DataMod - & gt; WaysADOQ - & gt; The Open ();
DataMod - & gt; WaysADOQ - & gt; The First ();
while(! DataMod - & gt; WaysADOQ - & gt; Eof)
{
TempStr=DataMod - & gt; WaysADOQ - & gt; FieldByName (" highwayID ") - & gt; AsAnsiString. SubString (5, 3);
TempStr +=DataMod - & gt; WaysADOQ - & gt; FieldByName (" highwayName ") - & gt; AsAnsiString;
2=TreeView1 - & gt; The Items - & gt; AddChild (Node1, TempStr);
2 - & gt; SelectedIndex=2;
DataMod - & gt; WaysADOQ - & gt; The Next ();
}
DataMod - & gt; ProvinceADOQ - & gt; The Next ();
}
}
The catch (... )
{
//
}
}
CodePudding user response:
I only have a report, to achieve it, or many tables?CodePudding user response:
Would you that format, a table is enoughCodePudding user response: