Right, I see now, well, I can't think of any way to retrieve a bunch of records that are around a given record, I can only think at this time to retrieve all records, then sort them out one by one and get your 5 (inc. bill) like that, this is very inneficient method but that's all I can think of right now.
strSQL = "SELECT allFIELDS FROM someTBL"
rsRecSet.Open strSQL, strCon
Dim I, arrID(4), arrName(4), arrCash(4)
Do While Not rsRecSet.EOF
If int(rsRecSet("ID")) = 29 Then
rsRecSet.Move - 2
For I = 0 To 4
arrID(I) = rsRecSet("ID")
arrName(I) = rsRecSet("Name")
arrCash(I) = rsRecSet("Cash")
rsRecSet.MoveNext
Next
Exit Do
End If
rsRecSet.MoveNext
Loop
|
This should do it, note you have to change things to match your data, also note, this was not tested and was just written as I went along with my code logic, but it should work, at least the principle should. Also not sure if ASP supports multi-column arrays (someARR(4, 4, 4)) if so you could use that.
Retrieve your data with this:
For I = 0 To 4
Response.Write(arrID(I) & " " & arrName(I) & " " & arrCash(I))
Next
|
The above should return your 5 records.
Let me know how it went.
Edited by theSCIENTIST