CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Jul 2000
    Posts
    67

    Recordset as parameters

    Thank you for good answers earlier.

    Is it possible to a whole recordset as a parameter in VB? I am trying to send a recordset as a parameter when i am starting a new application.. Do someone know how?

    K.


  2. #2
    Join Date
    May 2000
    Location
    New York, NY, USA
    Posts
    2,878

    Re: Recordset as parameters

    You can create recordset as a function

    Private Function myFunc(...any parameters to pass...) As ADODB.Recordset

    ...process stuff

    Set myFunc = rsSomeRecordsetCreated
    End Function


    call it as:

    Dim rs As ADODB.Recordset
    Set rs = myFunc(...)



    Iouri Boutchkine
    [email protected]
    Iouri Boutchkine
    [email protected]

  3. #3
    Join Date
    May 2000
    Location
    New York, NY, USA
    Posts
    2,878

    Re: Recordset as parameters

    Here is the code how you can send rs as parameter

    private Sub Form_Load()
    Dim rstTemp as new ADODB.Recordset
    rstTemp.CursorLocation = adUseServer
    rstTemp.CursorType = adOpenForwardOnly
    rstTemp.LockType = adLockReadOnly

    UseRecordset(rstTemp)

    rstTemp.Close
    set rstTemp = nothing
    End Sub

    public Function UseRecordset(Recordset as Object)

    'Check if this is Recordset
    If Not TypeOf Recordset is ADODB.Recordset then Exit Function

    'Do Sth with Recordset
    Recordset.AddNew
    '
    '
    '
    Recordset.Update

    End Function



    Iouri Boutchkine
    [email protected]
    Iouri Boutchkine
    [email protected]

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

Featured