以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- openqq server (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=91318) |
-- 作者:lk15502 -- 发布时间:2016/10/8 8:13:00 -- openqq server 请老师看看下面的代码,其中:Dim hrs As List(of DataRow) = DataTables("用户表").sqlSelect("group = \'" & nb2.name & "\'");编译错误:未声明名称“nb2” Dim trv1 As WinForm.TreeView = e.Form.Controls("TreeView1") Dim trv2 As WinForm.TreeView = e.Form.Controls("TreeView2") Dim nd1 As WinForm.TreeNode = trv1.SelectedNode If nd1.Level = 0 Then Return End If Dim dr As DataRow If e.Node.ParentNode IsNot Nothing Then \'取消父节点的选中标记,因为选中子节点,就不要选中父节点了 e.Node.ParentNode.Checked = False End If For Each cnd As WinForm.TreeNode In e.Node.Nodes \'取消子节点的选中标记,因为选中父节点,就不要选中子节点了 cnd.Checked = False Next dr = DataTables("用户表").sqlFind("name = \'" & nd1.Name & "\'") \'这里的代码是不是多余的 If dr Is Nothing Then \'不需要在用户表添加不存在的用户 dr = DataTables("用户表").AddNew() dr("name") = nd1.Name End If Dim nms As String For Each nd2 As WinForm.TreeNode In trv2.Nodes \'先添加分组 If nd2.Checked = True Then Dim hrs As List(of DataRow) = DataTables("用户表").sqlSelect("group = \'" & nb2.name & "\'") If hrs.count > 0 Then For Each hr As DataRow In hrs nms = nms & "," & hr("group") & "." & hr("name") Next End If End If Next For Each nd2 As WinForm.TreeNode In trv2.AllNodes \'然后是普通用户 If nd2.Level = 1 AndAlso nd2.Checked AndAlso nd1.Name <> nd2.Name Then nms = nms & "," & nd2.ParentNode.name & "." & nd2.Name End If Next If nms > "" Then dr("好友") = nms.Trim(",") Else dr("好友") = Nothing End If
|
-- 作者:有点蓝 -- 发布时间:2016/10/8 9:16:00 -- 这么明显的提示自己都看不到? |
-- 作者:lk15502 -- 发布时间:2016/10/8 9:23:00 -- 为什么nb1可以,nb2就不可以了,老师我是新手,给一个明确的提示;谢谢! |
-- 作者:有点蓝 -- 发布时间:2016/10/8 9:32:00 -- 你确定是nb1?而不是nd1? 爸妈给你取名叫张三,别人喊李四你也答应?
|