Hi,
I have a SQL table that contains documents and a table that contains users. I have another table that allows you to link more than one user to a document.
I have a query that then returns a list of documents with the users
DocID UserName
1 Jack
1 Jane
2 Ed
Now there is only one document with a DocID of 1 but the join returns two separate rows because there are two people linked to the document.
I then want to display a table that looks like this:
DocID Users
1 Jack, Jane
2 Ed
My recordset is stored in an array so far I have tried this:
The problem I have is that when the name "Jane" is displayed it moves onto the next row in the array by adding 1 to the array and the condition is no longer met so it exits the loop however because it's in a For i=0 To.... Loop, 1 gets added to i again and so the next rows is skipped.
I've been looking at this problem all day and have got to the stage where I can't see the wood for the trees so I would be very greatful for any help.
Thanks very much
Ed
I have a SQL table that contains documents and a table that contains users. I have another table that allows you to link more than one user to a document.
I have a query that then returns a list of documents with the users
DocID UserName
1 Jack
1 Jane
2 Ed
Now there is only one document with a DocID of 1 but the join returns two separate rows because there are two people linked to the document.
I then want to display a table that looks like this:
DocID Users
1 Jack, Jane
2 Ed
My recordset is stored in an array so far I have tried this:
Code:
Response.Write("<table>")
For i=0 To UBOUND(DocArray, 2)
Response.Write("<tr>")
Response.Write("<td>" & DocArray(0, i) & "</td>")
CurrentDocID=DocArray(0, i)
Do While DocArray(0, i)=CurrentDocID
Response.Write(DocArray(1, i) & ", ")
i=i+1
Loop
Next
Response.Write("</table>")
The problem I have is that when the name "Jane" is displayed it moves onto the next row in the array by adding 1 to the array and the condition is no longer met so it exits the loop however because it's in a For i=0 To.... Loop, 1 gets added to i again and so the next rows is skipped.
I've been looking at this problem all day and have got to the stage where I can't see the wood for the trees so I would be very greatful for any help.
Thanks very much
Ed