integer类型的值不能转换为1维数组

时间:2014-12-08 18:16:03

标签: asp.net vb.net

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

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

我想在我的webform中调用这个webservice方法,并且必须获取当前的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

请帮我继续

1 个答案:

答案 0 :(得分:0)

导致此错误的原因是您尝试在需要数组时将参数或函数返回值作为单个整数传递。您没有在代码中包含足够的内容以使其更具体。 (哪一行是错误的?什么是employeeIDFilter?什么是DoSomething?)

相关问题