Dim strDepart As String= e.Node.Text
If e.Node.AllNodes.Count>0 Then
For Each nd As WinForm.TreeNode In e.Node.AllNodes
strDepart = strDepart & iif(strDepart.Length>0 , "','" ,"") & nd.Text
Next
End If
Dim tblUser As Table = e.Form.Controls("tblUser").Table
Dim strSQL As String="s elect [用户号码],[姓名] from {用户名表} Where [系统ID] = 1 AND [部门] in('" & strDepart & "')"
tblUser.Fill(strSQL,gs_strActiveConn,True)
如上代码:
如果【用户名表】中有相应的用户,代码就没有问题,如果没有,就会出错:未将对象引用设置到对象的实例
如何解决,请都是看看