Adding to Recordsets

Results 1 to 2 of 2

Thread: Adding to Recordsets

  1. #1
    Join Date
    Dec 1969

    Default Adding to Recordsets

    The Query I am trying to execute should look something like this:<BR><BR>Select * from MY_Table where CategoryID = 2 OR CategoryID = 5 or CategoryID = 7 or CategoryID = 10 .... etc.<BR><BR>The difficulty I&#039m having is that the CategoryID&#039s are in an array, and the number of different categories varies in size for each user. The other difficulty is that there are multiple joins besides this basic sql statement.<BR><BR>The following is what I am trying to use, but I don&#039t know if it is possible to add to an existing recordset.<BR><BR>for i = 0 to UBound(CategoryArray)<BR> CategoryID = cint(trim(CategoryArray(i)))<BR> paramstring = "&#039"&UserID&"&#039, &#039"&CategoryID&"&#039"<BR> set RS=objConnection.Execute("exec sp_GetInbox " & paramstring)<BR>next<BR><BR><BR>I would appreciate any help or ideas... thanks.

  2. #2
    Join Date
    Dec 1969

    Default RE: Adding to Recordsets

    I am not familiar with working with stored procedues but for the first select you could use a replace to build your where clause<BR><BR>CategoryArray="2, 5, 7, 10"<BR><BR>CategoryArray=Replace(CategoryArray,"," ," Or CategoryId=")<BR><BR>Select * from MY_Table where CategoryID = " & CategoryArray<BR><BR><BR><BR><BR><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