Results 1 to 3 of 3

Thread: Matching Values from Recordset

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Aug 2002
    Location
    The Netherlands
    Posts
    96

    Matching Values from Recordset

    Ok I have a little (big) problem...I have 2 recordsets...1 of them only returns 1 value...the other recordset gives me more values...I loop through the recordset...And try to check if both values are the same...If they are the same I write BLA to the screen...

    VB Code:
    1. <%@LANGUAGE="VBSCRIPT"%>
    2. <!--#include file="../Connections/conn.asp" -->
    3. <%
    4. set rsCall = Server.CreateObject("ADODB.Recordset")
    5. rsCall.ActiveConnection = MM_connMSIS_STRING
    6. rsCall.Source = "SELECT ContactID FROM dbo.Calls WHERE CallID = 38"
    7. rsCall.CursorType = 0
    8. rsCall.CursorLocation = 2
    9. rsCall.LockType = 3
    10. rsCall.Open()
    11. rsCall_numRows = 0
    12.  
    13. %>
    14. <%
    15. set rsContactje = Server.CreateObject("ADODB.Recordset")
    16. rsContactje.ActiveConnection = MM_connMSIS_STRING
    17. rsContactje.Source = "SELECT ContactID, Achternaam FROM Contactpersonen WHERE FirmaID = 3503167"
    18. rsContactje.CursorType = 0
    19. rsContactje.CursorLocation = 2
    20. rsContactje.LockType = 3
    21. rsContactje.Open()
    22. rsContactje_numRows = 0
    23.  
    24. %>
    25. <%
    26. Dim Repeat1__numRows
    27. Repeat1__numRows = -1
    28. Dim Repeat1__index
    29. Repeat1__index = 0
    30. rsContactje_numRows = rsContactje_numRows + Repeat1__numRows
    31. %>
    32. <html>
    33. <head>
    34. <title>Untitled Document</title>
    35. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    36. </head>
    37. <body bgcolor="#FFFFFF" text="#000000">
    38. <table width="75%" border="1">
    39.   <%
    40. While ((Repeat1__numRows <> 0) AND (NOT rsContactje.EOF))
    41. %>
    42.   <tr>
    43.     <td><%=(rsCall.Fields.Item("ContactID").Value)%></td>
    44.     <td>
    45.       <% If (rsCall.Fields.Item("ContactID").Value = rsContactje.Fields.Item("ContactID").Value) Then %>
    46.       BLA
    47.       <% End If %> #####LINE 45#####
    48.     </td>
    49.     <td><%=(rsContactje.Fields.Item("ContactID").Value)%></td>
    50.   </tr>
    51.   <%
    52.   Repeat1__index=Repeat1__index+1
    53.   Repeat1__numRows=Repeat1__numRows-1
    54.   rsContactje.MoveNext()
    55. Wend
    56. %>
    57. </table>
    58. </body>
    59. </html>
    60. <%
    61. rsCall.Close()
    62. %>
    63. <%
    64. rsContactje.Close()
    65. %>
    When I run the code...I get the following error...
    Microsoft VBScript runtime error '800a000d'

    Type mismatch

    /develop/TestsChris/TMPgd0um8v5f3.asp, line 45

    Does anyone have a clue on what goes wrong?

  2. #2
    Frenzied Member andreys's Avatar
    Join Date
    Sep 2002
    Location
    Los Angeles
    Posts
    1,615
    Are these two tables, that you are comparing, in the same database?

  3. #3
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170
    Check to see if the ContactID field of both tables are of the same datatype.

Posting Permissions

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



Click Here to Expand Forum to Full Width