[英]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.