Global Variables/Arrays

Results 1 to 2 of 2

Thread: Global Variables/Arrays

  1. #1
    Gord Guest

    Default Global Variables/Arrays

    Hi, <BR>I have a search pages that is displaying duplicate results. I am using an array to store the ID fields and remove duplicates before displaying. My problem is the declaration of my array. Everything works fine if I Dim it within the OnEnter code but I need it to be global so I can call it from within the body of the page.<BR><BR>Here&#039s a quick overview of my page.<BR><BR>&#060;SCRIPT ID=serverEventHandlersVBS LANGUAGE=vbscript RUNAT=Server&#062;<BR>Dim MyArray()<BR>Redim MyArray(999)<BR>Dim J<BR><BR>&#060;sub onEnter code&#062;<BR>Request.Querystring blah blah<BR>SetSQLtext<BR>Open Database<BR><BR>J=1<BR>rsProperties.moveFirst<BR>D o until rsProperties.EOF<BR><BR>MyArray(J) = rsProperties.fields.getValue("ID")<BR>Response.Wri te (" Set array value ")<BR>Response.Write (J)<BR>Response.Write (MyArray(J))<BR>rsProperties.moveNext<BR>J=J + 1<BR>Loop<BR><BR>&#060;End Sub&#062;<BR><BR>I am aware of the Distinct and DistinctRow SQL properties but they do not work because I have multiple fields and each record is technically distinct. (ie. Each Id can have multiple values in the category field, that is why it&#039s displaying the duplicates in the first place)<BR><BR>Thanks,<BR><BR>Gord

  2. #2
    John Weeflaar Guest

    Default RE: Global Variables/Arrays

    Try:<BR>MyArray(J) = rsProperties("ID")<BR>instead of<BR>MyArray(J) = rsProperties.fields.getValue("ID")<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
  •