Current provider does not support the necessary interfaces for sorting or filtering.

Results 1 to 5 of 5

Thread: Current provider does not support the necessary interfaces for sorting or filtering.

  1. #1
    Join Date
    Feb 2010
    Posts
    2

    Default Current provider does not support the necessary interfaces for sorting or filtering.

    Ok, the situation is simple or so it would seem. I can't use Recordset.Sort on my recordset which comes from the result of a stored procedure.

    Exact error message:
    ADODB.Recordset error '800a0cb3'
    Current provider does not support the necessary interfaces for sorting or filtering.

    This example will work no problem:
    Code:
    Set rs = server.CreateObject("ADODB.Recordset")
    rs.CursorLocation = 3
    rs.open "Select * from sometable", objDBConn, 1, 1, 1
    rs.Sort = "somecolumn desc"
    However, I don't want to use ad-hoc queries in my code, so I call stored procs as follows:

    Code:
    Set cmd = server.CreateObject("ADODB.Command")
    Set cmd.ActiveConnection = objDBConn
    cmd.CommandText = "some_proc"
    cmd.CommandType = adCmdStoredProc
    Set rs = server.CreateObject("ADODB.RecordSet")
    rs.CursorLocation = 3
    Set rs = cmd.Execute
    rs.Sort = "somecolumn desc"
    The above gives me an error... so what's the deal?

  2. #2
    Join Date
    Dec 1969
    Posts
    144

    Default

    Try setting the cursortype as well.
    objRecordset.CursorType = adOpenDynamic

  3. #3
    Join Date
    Dec 1969
    Posts
    96,033

    Default

    Right concept, wrong answer. There is NO POINT in using adOpenDynamic with ASP and VBScript. It implies that you are going to provide a "callback" in case the underlying data changes. But VBS (and ASP) doesn't support callbacks.

    Instead, use adOpenStatic, which has all the qualities of adOpenDynamic that you need but none of the disadvantages.

    Incidentally, adOpenStatic is just the number 3, so you could just do:
    objRecordset.CursorType = 3

    You should to that *before* you do the open.

    Or you could simplify that overly complex code to this:
    Code:
    Set rs = server.CreateObject("ADODB.RecordSet")
    rs.CursorLocation = 3 ' adUseClient
    rs.Open "EXEC some_proc", objDBConn, 3
    rs.Sort = "somecolumn desc"

  4. #4
    Join Date
    Feb 2010
    Posts
    2

    Default

    Thanks for the replies.

    You are correct in saying that I could use an RS.Open and simply call the procedure that way however but was wondering if it was do able from a Command.Execute but I guess not


  5. #5
    Join Date
    Dec 1969
    Posts
    96,033

    Default

    Oh, I *think* you *can* use the Command object. But you still have to call RS.Open, I believe. Try this:
    Code:
    Set cmd = server.CreateObject("ADODB.Command")
    Set cmd.ActiveConnection = objDBConn
    cmd.CommandText = "some_proc"
    cmd.CommandType = adCmdStoredProc
    Set rs = server.CreateObject("ADODB.RecordSet")
    rs.CursorLocation = 3
    rs.Open , cmd, 3 
    rs.Sort = "somecolumn desc"

Posting Permissions

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