CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Jul 2004
    Location
    Kathmandu, Nepal
    Posts
    84

    typecasting objects into recordsets

    H3llo
    I Have One Function Named
    Code:
    public Function Executequery(sql As String) As Object
    
    dim Rs As New Adodb.recordset Set Rs=con.execute(sql) 'con Is A Connection Executequery
    =rs End Function
    The Problem With Me Is The Above Function Doesnot Work
    Because I Am Returning A Recordset But My Function Expects An Object. So I Need To Typecast Recordset To Object And Vice Versa.

    How Can I Do It? Anyone Plz Can U Help Me?

  2. #2
    Join Date
    Jan 2000
    Location
    Olen, Belgium
    Posts
    2,477

    Re: typecasting objects into recordsets

    You are returning an object, zso you will need to assign the return value using the Set command
    Code:
    public Function Executequery(sql As String) As Object
        dim Rs As New Adodb.recordset
        Set Rs=con.execute(sql)  'con Is A Connection
        Set Executequery = Rs
    End Function
    Tom Cannaerts
    email: cakkie@cakkie.be.remove.this.bit
    www.tom.be (dutch site)

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