SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Hybrid View

  1. #1
    Non-Member
    Join Date
    Aug 2007
    Posts
    494
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Exclude double values

    Hi, I need your help.

    I need exclude double values in this list:

    Code:
    .Mem C
    .Mem C
    For A
    .Mem C
    For A
    Gia A
    .Mem C
    For A
    Gia A
    Cir G.
    I try this asp code:
    Code:
             str = objRS("phrases")
             arr = split(str,"..")
    
                if IsArray(arr) then
                   for xE = 0 to Ubound(arr)
                   
                      strings = arr(xE)
                      
                      if not strings then
                         response.write strings & arr(xE) & "<br />"
                      end if
                      
                   next
                end if
    But error is:
    Microsoft VBScript runtime (0x800A000D) Type mismatch

    Can you help me?

  2. #2
    Non-Member
    Join Date
    Aug 2007
    Posts
    494
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Code:
    <%
    
    Set myDict = Server.CreateObject("Scripting.Dictionary")
    
    Set objconn = Server.CreateObject("ADODB.Connection")
    objconn.Open "DRIVER={MySQL ODBC 5.1 Driver};SERVER=...;"
    
    SQL = " SELECT * FROM _newTable1 "  
    Set objRS = Server.CreateObject("ADODB.Recordset")
    objRS.Open SQL, objconn
    
       if Not objRS.eof then
          while not objRS.eof 
    
             str = objRS("frase")
             myArray = split(str,"..")
    
             for index = 0 to UBound(myArray)
                if ( not myDict.Exists(myArray(index)) ) then
                   myDict.Add myArray(index), myArray(index)
                      Response.Write myDict(myArray(index)) & "<br>"
                end if
             next
    
             objRS.movenext()
          wend
       end if
    
    objRS.Close()
    Set objRS = Nothing
    
    objConn.Close()
    Set objConn = Nothing
    
    Set myDict = Nothing
    
    %>
    Output:

    Code:
    .Mem C
    For A
    Gia A
    Cir G.


Bookmarks

Posting Permissions

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