Results 1 to 5 of 5

Thread: From Command object to recordset

  1. #1

    Thread Starter
    New Member
    Join Date
    May 2000
    Location
    Baulkham Hills, NSW Australia
    Posts
    14

    From Command object to recordset

    When using a command object to execute a stored procedure and assigning it to a recordset, the recordset properties don't work e.g recordcount or movelast etc.

    The cursor is client side and dynamic, if I don't use a command object everythings fine but I want to be able to use stored procedures.

    Any tips would be much appreciated, cheers.
    kiss

  2. #2
    Addicted Member rikshawdriver's Avatar
    Join Date
    Apr 2001
    Posts
    160
    Hint: The problem may be with LockType. You have not mentioned it.

  3. #3
    Lively Member
    Join Date
    Nov 2000
    Location
    Ireland
    Posts
    99
    rikshaw
    What lock type would you suggest?
    Ive tried to fill a datagrid with the results of a query contained in a stored procedure and called through a command object.
    I get a "recordset not bookmarkable" error

  4. #4
    PowerPoster Lethal's Avatar
    Join Date
    Oct 2000
    Location
    Ohio
    Posts
    2,496
    One more thing, you can't have a client side cursor and it be dynamic, it is static..

  5. #5
    PowerPoster Lethal's Avatar
    Join Date
    Oct 2000
    Location
    Ohio
    Posts
    2,496
    Here's what I use and works with all recordset methods.

    Code:
     Set CN = New ADODB.Connection   ' Establish a connection to the datasource
        strConnection = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;" & _
                        "Initial Catalog=ICE.NET;Data Source=MPNETICE2000"
        CN.Open strConnection
       
        Set RS = New ADODB.Recordset  ' Initialize cursor type and lock type
        With RS
            .CursorType = adOpenStatic
            .LockType = adLockOptimistic
            .CursorLocation = adUseClient
        End With
    
        Set CMD = New ADODB.Command
        With CMD
            .CommandText = "Invoice_All"
            .CommandType = adCmdStoredProc
        End With
         RS.Open CMD.CommandText, CN

Posting Permissions

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



Click Here to Expand Forum to Full Width