Results 1 to 4 of 4

Thread: sort recordset property

  1. #1
    Fanatic Member
    Join Date
    Oct 01
    Location
    didn't decide yet
    Posts
    566

    sort recordset property

    when i tried to use that property with Jet.OLEDB.4.0 Provider it said that the provider doesn't support that.

    which provider supports it? and can i use that provider working with access DB?

    thnks
    Come and get our ISDN CallerID http://www.3wm.biz

  2. #2
    ASP.NET Moderator mendhak's Avatar
    Join Date
    Feb 02
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,174
    Sorting Records
    Like the Filter property, the DAO and ADO Sort properties differ in that the DAO Sort method applies to subsequently opened Recordset objects, and for ADO it applies only to the current Recordset object.

    The Microsoft Jet 4.0 OLE DB Provider doesn't support the IViewFilter or IViewSort OLE DB interfaces that ADO uses to filter and sort Recordset objects. For the Filter property, ADO will automatically call the client cur....

    I think this implies that you should use ADO if you wish to use the sort method.

  3. #3
    Fanatic Member
    Join Date
    Oct 01
    Location
    didn't decide yet
    Posts
    566
    mendhak i m using ADO. but a code like bellow is not working saying that is a provider problem
    VB Code:
    1. cnn.connectionstring="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=access.mdb"
    2. cnn.open
    3. rs.CursorLocation=adUseClientset
    4. set rs=cnn.execute("Select * from Table1")
    5. rs.sort="field1"
    Come and get our ISDN CallerID http://www.3wm.biz

  4. #4
    PowerPoster
    Join Date
    Oct 02
    Location
    British Columbia
    Posts
    9,758
    By default the statement

    Set Recordset = Connection.Execute

    returns a Forward-Only cursor, which cannot be sorted.

    Use the Recordset.Open method instead.

    rs.Open "Select * from Table1", cnn, adOpenStatic, adLockReadOnly

    You will then be able to sort the records.

    FYI: The Connection.Execute statement creates a new recordset. The rs.CursorLocation = adUseClient statement before the Execute statement is useless.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •