简体   繁体   English

重载解析失败,因为没有可访问的“参数”接受此数量的 arguments

[英]Overload resolution failed because no accessible 'Parameters' accepts this number of arguments

I have upgraded a VB.net application from 2.0 to 4.6.我已将 VB.net 应用程序从 2.0 升级到 4.6。

I am getting below error in the piece of code我在这段代码中遇到错误

System.MissingMemberException: Overload resolution failed because no accessible 'Parameters' accepts this number of arguments. System.MissingMemberException:重载解析失败,因为没有可访问的“参数”接受此数量的 arguments。

What may be the issue?可能是什么问题?

Private Function MyFunction123(ByRef oXMLConfigData As XmlNodeList, ByRef oCmdCommandCol As ArrayList, ByVal iCmdCount As Integer, ByRef oReturnDataset As ReturnValues) As Boolean

    Dim iCount As Integer
    Dim iRetVal As Integer
    Dim oCNode As XmlNode       
    Dim retVal As Boolean = False

    iRetVal = oCmdCommandCol(iCmdCount).Parameters(oCNode.ChildNodes(iCount).Attributes("SPParameter").Value).Value
    oCNode.ChildNodes(iCount).InnerText = iRetVal
    oReturnDataset.ReturnValues.AddReturnValuesRow(oCNode.Attributes("Name").Value, oCNode.ChildNodes(iCount).Attributes("Name").Value, oCNode.ChildNodes(iCount).InnerText)
    retVal = True
End Function

Function is called as Function 被称为

If Not MyFunction123(oXMLConfigSteps, oCmdCollection, iCountCmd, oReturnDataset) Then
    'Statements
End If

Where is the MyFunction123 method called, is it inside another function and outside the current class where it is declared, Since your function "MyFunction123" is Private, and if you are calling it outside the class you have to change access modifier or protected or public. Where is the MyFunction123 method called, is it inside another function and outside the current class where it is declared, Since your function "MyFunction123" is Private, and if you are calling it outside the class you have to change access modifier or protected or public . Also change EXIT to "Exit Function" if call is inside another function.如果调用在另一个 function 内,也将 EXIT 更改为“Exit Function”。

I got it.我知道了。

Arraylist "oCmdCommandCol" was filled with multiple SqlCommand objects hence and explicit type cast is required. Arraylist “oCmdCommandCol” 填充了多个 SqlCommand 对象,因此需要显式类型转换。 I changed the code as below and it worked.我更改了如下代码并且它起作用了。 Hope it will help someone in similar situation.希望它会帮助有类似情况的人。

Private Function MyFunction123(ByRef oXMLConfigData As XmlNodeList, ByRef oCmdCommandCol As ArrayList, ByVal iCmdCount As Integer, ByRef oReturnDataset As ReturnValues) As Boolean

    Dim iCount As Integer
    Dim iRetVal As Integer
    Dim oCNode As XmlNode       
    Dim retVal As Boolean = False


    Dim cmd As SqlCommand
    cmd = New SqlCommand()
    cmd = CType(oCmdCommandCol(iCmdCount), SqlCommand)
    iRetVal =  cmd.Parameters(oCNode.ChildNodes(iCount).Attributes("SPParameter").Value).Value


    oCNode.ChildNodes(iCount).InnerText = iRetVal
    oReturnDataset.ReturnValues.AddReturnValuesRow(oCNode.Attributes("Name").Value, 
    oCNode.ChildNodes(iCount).Attributes("Name").Value, oCNode.ChildNodes(iCount).InnerText)
    retVal = True
End Function

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 重载解析失败,因为没有可访问的“新”接受此数目的参数 - overload resolution failed because no accessible 'new' accepts this number of arguments 重载解析失败,因为没有可访问的“ ExecuteScalar”接受此数量的参数 - Overload resolution failed because no accessible 'ExecuteScalar' accepts this number of arguments 重载解析失败,因为没有可访问的'writealltext'接受此数量的参数 - overload resolution failed because no accessible 'writealltext' accepts this number of arguments 尝试将stringbuilder文本写入批处理文件时,“由于没有可访问的'New'接受此数目的参数,所以过载解析失败” - “Overload resolution failed because no accessible 'New' accepts this number of arguments” when trying to write stringbuilder text into a batch file VB.NET MVC重载解析失败,因为没有可访问的“创建”接受此数量的参数 - VB.NET MVC Overload resolution failed because no accessible 'Create' accepts this number of arguments VBNET重载,因为没有可访问的“ int”接受数字参数 - VBNET Overload because no accessible 'int' accepts number arguments 重载解析失败,因为没有可访问的“ DataBind”最特定于这些参数 - overload resolution failed because no accessible 'DataBind' is most specific for these arguments 重载解析失败,因为对于这些参数,没有可访问的“新”是最具体的 - Overload resolution failed because no accessible 'new' is most specific for these arguments 重载解析失败,因为没有可访问的“新”是这些参数最具体的: - Overload resolution failed because no accessible 'New' is most specific for these arguments: 重载解决失败,因为无法使用这些参数调用可访问的“加入” - Overload resolution failed because no accessible 'Join' can be called with these arguments
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM