将数据从我的应用程序传递到我的 ASMX Web 服务时,我总是遇到转换错误
我的网络服务代码
Public Function SetAlterLogTrx(ByVal qsTrx As List(Of String)) As String
Dim oStatus As New LogAlterStatusDsp
Dim iRec As Integer = 0
Using DBCONN As New SqlConnection()
Dim strConnString As String = ConfigurationManager.ConnectionStrings("Conn").ConnectionString
DBCONN.ConnectionString = sDBConnString
If qsTrx.Count = 0 Then
Return "Failed"
Else
Dim sQueryList As Array = qsTrx.ToArray
For Each sQuery As String In sQueryList
Using UpdateOutCommand As New SqlCommand(sQuery, DBCONN)
Try
With DBCONN
.Open()
iRec = UpdateOutCommand.ExecuteNonQuery()
.Close()
End With
Catch ex As Exception
Return "Failed"
End Try
End Using
Next
Return "Ok"
End If
End Using
End Function
我的客户代码
dim qsArray() as string
'This array has many lines
Using oSvc As New AnfaEngine.AnfaWSSoapClient
Dim svcReplay As AnfaEngine.LogAlterStatusDsp
Dim oList As New List(Of String)
oList.AddRange(qsArray.Cast(Of String).ToList)
svcReplay = oSvc.SetAlterLogTrx(oList)
End Using
我总是收到此错误消息:
无法将“System.Collections.Generic.List`1[System.String]”类型的对象转换为“WS.ArrayOfString”类型。
我应该怎么做才能解决这个问题。