passing array from asp to component

Results 1 to 2 of 2

Thread: passing array from asp to component

  1. #1
    ed Guest

    Default passing array from asp to component

    gurus,<BR><BR>i&#039;m trying to pass an array to a VB component and i&#039;m getting <BR>Error Type:<BR>ADODB.Fields (0x800A0CC1)<BR>Item cannot be found in the collection corresponding to the requested name or ordinal.<BR><BR>i checked the fieldnames and they are correct. if i pass all fields by their corresponding value it works like a charm. but when i try to do it with an array, it craps out.<BR><BR>here&#039;s from the VB component:<BR>Public Function addrec(ByVal connectionstr As String, ByVal tablename As String, arrayfields, arrayvalues)<BR>...<BR>With adoRecordset<BR> .AddNew<BR> For i = LBound(arrayfields) To UBound(arrayfields)<BR> !arrayfields(i) = arrayvalues(i)<BR> Next<BR> .Update<BR>End With<BR>...<BR><BR>thanks in advance,<BR>ed<BR>

  2. #2
    --=|[]|=-- Guest

    Default RE: passing array from asp to component

    Always try to pass your arrays ByRef.<BR><BR>But I believe that since your COM objects run in a different memory space, you cannot pass arrays ByRef to your COM objects anyway.<BR><BR>Anyhow you end up passing the array, you might want to also validate each element in your array and make sure they are all accurate. Add some logic processing "If...Then...Else...End If" within your for loop. You could even write all the data out to the page to see where it is "crapping out."<BR><BR>Just check which data you are extracting and make sure the number of elements matches the number of fields in your recordset.<BR><BR>HtH<BR>

Posting Permissions

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