整数类型的值不能转换为一维数组



>Curriculum 是一个 .asmx 文件,其中包含返回特定值的 Web 服务方法列表,此方法 GetMyEmployeeId 就是这样一个 webmethod,我将从我的 web 表单调用,它返回一个包含当前用户(主页)ID 的数组

Public Function GetMyEmployeeId() As Integer()
            Return New Integer() {Current.HomepageUserId}
End Function

我想在我的网络表单中调用这个 web 服务方法,并且必须获取当前的 employeeID,以便我可以将其传递给我的其他方法 DoSomething(这里它将返回的 employeeID 作为参数)

_curTree是课程课的对象。

    Private Function GetEmployeeActual() As Items
    Dim item as Items       
    Dim employeeID As Integer()
                    'I am guessing that, am declaring the employeeID wrong ( it should not be an integer datatype may be because the GetMyEmployeeID returns an array of current user ID's)
    employeeID = _curTree.GetMyEmployeeId()
    item = DoSomething(employeeID)
                    'I am getting the error here as"value of type integer cannot be converted to 1-dimensional array"
    Return item
    End Function

请帮我继续

导致此错误的原因是,当您需要数组时,您尝试将单个整数作为参数或函数返回值传递。您在代码中没有包含足够的内容来更具体。(错误在哪一行?什么是员工 IDFilter?什么是做某事?

最新更新