Retrieving a single row

Results 1 to 2 of 2

Thread: Retrieving a single row

  1. #1
    Join Date
    Dec 1969

    Default Retrieving a single row

    Hello,<BR><BR>I&#039;d like to find a way to get one row from a table at random (in SQL), without creating a recordset, when making a call from an ASP page. How may I access to the row 22 or row 45, in order to display it at random in an ASP page ?<BR><BR>Thank you for any idea,<BR><BR>Bruno

  2. #2
    Join Date
    Dec 1969

    Default RE: Retrieving a single row

    A recordset *CAN* contain a single row. And there is no way, with ADO, to get data from a table *without* using a recordset.<BR><BR>So if you just do<BR><BR>SELECT * FROM table WHERE rowID = 22<BR><BR>you will get one record.<BR><BR>*NOW* your problem is putting a "rowID" onto each record. The DB does *NOT* do that for you. You need to add a field for just this purpose.<BR><BR>Further, if you delete any records, then the rowID&#039;s will no longer be contiguous, will they? So you&#039;ll have to account for that.<BR><BR>See the ASPFAQs for a long topic on getting random records from databases.<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