Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_databases thread: Sort on open RecordSet using Access 2000 database


Message #1 by "Robert Larsson" <robert.l@m...> on Fri, 19 May 2000 12:5:52
How do I make a recordset.sort="columnname" using an Access 2000 Database 

and file connection on a Open recordset like the example below.



Is it possible that Access doesn't support the Sort method ?



I don't wan't any messages saying that I should use the "Order By" in the 

SQL statement, it works but is not useful in my solution, because I want't 

sort an open database many times while it's open instead of open / close or 

requery.



--- ERROR MESSAGE ------



Error Type:

ADODB.Recordset (0x800A0CB3)

Object or provider is not capable of performing requested operation.

/sort.asp, line 13



--- EXAMPLE ------------



Dim cn, rs



Set cn = Server.CreateObject("ADODB.Connection")

Set rs = Server.CreateObject("ADODB.RecordSet")

cn.Open "Driver={Microsoft Access Driver (*.mdb)}; DBQ=" & 

Server.MapPath("database.mdb"))



With rs

	.ActiveConnection = cn

	.CursorType = adOpenStatic

	.CursorLocation = adUseServer

	.PageSize = 1

	.Open "select * from words"

	.Sort = "word"                ' THIS LINE DOESN'T WORK! (Line 13)

End With



Response.Write(rs("word") & "<br>")



rs.Close

cn.Close

Set rs = Nothing

Set cn = Nothing







Cheers,

Robert Larsson!


  Return to Index