ASP.NET System.FormatException
I have the follwing error:
Stack Trace:
at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall)
at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)
at DocumentManager.Web.MidasInterface.MIDASCustomerInfo.GetBaseRate(String ccy, String brcod) in D:\2010\RETAIL\DocumentManager.Web\Web References\MidasInterface\Reference.vb:line 696
...
the inner message:
System.FormatException: Index (zero based) must be greater than or equal to zero and less than the size of the argument list.
at iMIDAS.MIDASCustomerInfo.GetBaseRate(String ccy, String brcod)
the web method query in db
<WebMethod()> Public Function GetBaseRate(ByVal ccy As String, ByVal brcod As String) As ResponseObject
Dim connAS400 As New Data.OleDb.OleDbConnection
Dim dsAS400 As Data.DataSet
Dim cmdAS400 As Data.OleDb.OleDbCommand
Dim retVal As Object
Try
connAS400.ConnectionString = CreateConnectionStringMidas(DataSource, DataCatalog, DataUser, DataPassword)
cmdAS400 = New Data.OleDb.OleDbCommand(CreateSQLBaseRate(ccy, brcod), connAS400)
connAS400.Open()
retVal = cmdAS400.ExecuteScalar()
If IsNothing(retVal) Or IsDBNull(retVal) Then
oResponse.ResponseState = False
oResponse.ResponseMessage = String.Format("No Records Found for base rate code [{1}]!", brcod)
Else
oResponse.ResponseState = True
oResponse.ResponseDa开发者_如何学Gota = CType(retVal, String).ToString().ToUpper()
End If
Return oResponse
Catch ex As Exception
Throw ex
Finally
connAS400.Close()
End Try
End Function
Any ideas?
I'm pretty sure it's this line:
oResponse.ResponseMessage = String.Format("No Records Found for base rate code [{1}]!", brcod)
which should be zero indexed, not one indexed, so:
oResponse.ResponseMessage = String.Format("No Records Found for base rate code [{0}]!", brcod)
精彩评论