Results 1 to 3 of 3


  1. #1
    Charles Guest

    Default PLEASE HELP!!

    Hello,<BR><BR>When I try to pass an account number, I&#039;m getting the following error message: Item cannot be found in the collection corresponding to the requested name or ordinal. The error appears at line: Set var2 = var1.GetOrderTest(AccountNumber) <BR><BR>Any ideas what&#039;s causing such error message, the accountnumber that I am passing does exist in the data base. <BR><BR>Thanks, <BR><BR>Code from VB: <BR><BR> Dim var1 As SNCls3.SNOrderDir3 <BR> Dim var2 As Collection <BR> Dim var3 <BR> AccountNumber = Trim("test12345") <BR> Set var1 = CreateObject("SNCls3.SNOrderDir3") <BR> Set var2 = var1.GetOrderTest(AccountNumber) <BR> For Each var3 In var2 <BR> List1.AddItem var3.Symbol & " " & var3.OrderType & " " & var3.CompanyName & " " & var3.Quantity & " " & var3.OrderStatus & " " & var3.RecordId & " " & var3.TransactionType & " " & var3.CurrentDate & " " <BR> Next <BR> Set var1 = Nothing <BR> Set var2 = Nothing <BR><BR>COM: <BR>Public Function GetOrderTest(AccountNumber) As Collection <BR> Dim objOContext As ObjectContext <BR> Set objOContext = GetObjectContext() <BR> Dim lErrNo As Long <BR> Dim sErrDesc As String <BR> On Error GoTo ErrorHandler <BR> Dim GetOrders As New Collection <BR> Dim objConn As New ADODB.connection <BR> Dim objRS As New ADODB.recordset <BR> Dim objCommand As New ADODB.Command <BR> Dim objParam As New ADODB.Parameter <BR> With objConn <BR> .ConnectionString = DB_CONNECTIONSTRING <BR> .Open <BR> End With <BR> &#039;Use command object to send accountnumber to stored procedure <BR> &#039;******************************************** **************** <BR> Set objCommand = New ADODB.Command <BR> With objCommand <BR> .CommandText = "GetTest" <BR> .CommandType = adCmdStoredProc <BR> .ActiveConnection = objConn <BR> End With <BR> Set objParam = objCommand.CreateParameter("@AccountNumber", adVarChar, adParamInput, 9, AccountNumber) <BR> objCommand.Parameters.Append objParam <BR> Set objRS = objCommand.Execute <BR> &#039;******************************************** ************************** <BR> &#039;recordset.Open "GetTest", connection, adOpenForwardOnly, adLockReadOnly, adCmdText <BR> Do While Not objRS.EOF <BR> Dim SNOrder As New SNCls3.SNOrder3 <BR> SNOrder.Symbol = Trim$(recordset("Symbol")) <BR> SNOrder.OrderType = Trim$(recordset("OrderType")) <BR> SNOrder.CompanyName = Trim$(recordset("CompanyName")) <BR> SNOrder.TransactionType = Trim$(recordset("TransactionType")) <BR> SNOrder.Quantity = Trim$(recordset("Quantity")) <BR> SNOrder.RecordId = Trim$(recordset("RecordID")) <BR> SNOrder.OrderStatus = Trim$(recordset("OrderStatus")) <BR> SNOrder.CurrentDate = Trim$(recordset("CurrentDate")) <BR> SNOrder.TradeDate = Trim$(recordset("TradeDate")) <BR> SNOrder.SettlementDate = Trim$(recordset("SettlementDate")) <BR> SNOrder.AccountType = Trim$(recordset("AccountType")) <BR> SNOrder.Price = Trim$(recordset("Price")) <BR> SNOrder.Duration = Trim$(recordset("Duration")) <BR> SNOrder.CommissionType = Trim$(recordset("CommissionType")) <BR> SNOrder.Solicited = Trim$(recordset("Solicited")) <BR> SNOrder.Canceldate = Trim$(recordset("CancelDate")) <BR> SNOrder.SNCustomerAccNum = Trim$(recordset("SNCustomerAccNum")) <BR> SNOrder.SNOrderSeqNum = Trim$(recordset("SNOrderSeqNum")) <BR> SNOrder.PershingRefNum = Trim$(recordset("PershingRefNum")) <BR> SNOrder.EnteredToPershing = Trim$(recordset("EnteredToPershing")) <BR> SNOrder.CancelOrder = Trim$(recordset("CancelOrder")) <BR> SNOrder.LastUpdate = Trim$(recordset("LastUpdate")) <BR> <BR> GetOrders.Add SNOrder <BR> Set SNOrder = Nothing <BR> objRS.MoveNext <BR> Loop <BR> &#039; Using MTS to complete transaction <BR> objOContext.SetComplete <BR> Set objRS = Nothing <BR> Set objConn = Nothing <BR> Set GetOrderTest = GetOrders <BR> Exit Function

  2. #2
    Join Date
    Dec 1969

    Default Why not...

    ...just to see WHERE the error this *without* the component, temporarily. (Just do the query in VBS and get the RecordSet and Response.Write all the values from it.)<BR><BR>The problem with that error message is that we can&#039;t tell whether you are getting an error when VBS makes the call (which I doubt, but which is possible) or when something inside your component does some operation (more likely). See, you can get that from trying to get a field, by name, from a recordset and misspelling the name. But you can also, of course, get it from the collection that your component is returning from that call. So who knows???<BR><BR>Truthfully, when I responded before, I *expected* you to tell me that the error was on the List.AddItem line.<BR><BR>

  3. #3
    Join Date
    Dec 1969

    Default RE: PLEASE HELP!!

    Try to run your storedprocedure in query analiser,also why not to debug:make a point on place you have error, F5 then F8 and see what is happening...vb has a good debuger

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts