For Each dr1 As DataRow In dt1.datarows
改成
For Each dr1 As DataRow In dt1.sqlSelect("")
对应的AddChildren1函数,也要对应修改成后台查询