|
 |
access_asp thread: DB Cursors | Recordsets | and the like
Message #1 by "Andrew Matheson" <amatheso@y...> on Sun, 19 Jan 2003 14:59:52
|
|
Hi All,
I have a simple problem (i hope). I would like to know how to filter
through a recordset until i come accross a particular record ie a
particular customer. How do i search the recordset, and once i have found
the customer how do i get to the next one in the recordset.
I am pretty sure it cant be by a where clause in the sql cause then i
would only get one customer. I am guessing there may be a search function
with cursors?????
ANy Advice would help
Cheers,
Andrew
Message #2 by "Ken Schaefer" <ken@a...> on Mon, 20 Jan 2003 14:03:59 +1100
|
|
You use the WHERE clause to limit the dataset to just those records that you
want (eg the 5 records pertaining to a particular customer, rather than
returning all 5000 records):
strSQL = _
"SELECT OrderID " & _
"FROM Orders " & _
"WHERE CustomerID = 5"
Set objRS = objConn.Execute(strSQL)
If Not objRS.EOF then
Do While Not objRS.EOF
Response.Write(objRS("OrderID") & "<br>" & vbCrLf)
objRS.MoveNext
Loop
Else
' No matching records
End If
Cheers
Ken
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
From: "Andrew Matheson" <amatheso@y...>
Subject: [access_asp] DB Cursors | Recordsets | and the like
: Hi All,
:
: I have a simple problem (i hope). I would like to know how to filter
: through a recordset until i come accross a particular record ie a
: particular customer. How do i search the recordset, and once i have found
: the customer how do i get to the next one in the recordset.
:
: I am pretty sure it cant be by a where clause in the sql cause then i
: would only get one customer. I am guessing there may be a search function
: with cursors?????
:
:
: ANy Advice would help
|
|
 |