0

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.ResponseData = CType(retVal, String).ToString().ToUpper()
            End If
            Return oResponse
        Catch ex As Exception
            Throw ex
        Finally
            connAS400.Close()
        End Try
    End Function

Any ideas?

3
  • you should provide the whole stack trace dump to be useful Mar 17, 2011 at 16:53
  • I see all kinds of potential exceptions in the above code. How do you know, for instance, that brcode is not null?
    – camainc
    Mar 17, 2011 at 17:00
  • I don't understand what shoud hapened when brcode is null?? Mar 17, 2011 at 17:12

1 Answer 1

3

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)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.