Results 1 to 7 of 7

Thread: DLL problem... plz advice

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Nov 2000
    Location
    Posts
    130
    Goodday mate...

    I have a problem here...
    It seems that I can't pass ADODB.Recordset type from my EXE program to the DLL program. Is it true?
    You see, I declare the parameter in the DLL program as ADODB.Recordset type. But when I try to use in the EXE program, it gives me Recordset type. And when I run the program, it gives me the following error:

    Run time error '3001'
    Arguments are of the wrong type, are out of acceptance range, or are in conflict with one another.

    Is this error cause by what I expected/said it was? If yes, how do I solve it?

    Your advice will be most appreciated...

  2. #2
    Addicted Member
    Join Date
    Jun 1999
    Location
    Los Angeles
    Posts
    186
    How are you sending the recordset? Byref? Byval?
    You shold pass it Byref.

    I use pass recordsets everyday without any problems.

    Code:
    Public function ReceiveRs(byref Rs as ADODB.Recordset) as boolean
    'bla bla  bla
    end function
    André

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Nov 2000
    Location
    Posts
    130
    eh... I didn't use either of one...
    Can this be the problem?
    I'll try using ByRef method...

    By the way, thanks a lot Andre...

  4. #4

    Thread Starter
    Addicted Member
    Join Date
    Nov 2000
    Location
    Posts
    130
    I've tried it...
    but it still gives me the same error...

  5. #5
    Addicted Member
    Join Date
    Jun 1999
    Location
    Los Angeles
    Posts
    186
    Can you show me your Method call and Function declaration?

    André

  6. #6
    Addicted Member
    Join Date
    Jun 1999
    Location
    Los Angeles
    Posts
    186
    I have created a little project to test this and have no problems:

    Client: Standard EXE

    Here I declare a Connection and Recordset object (ADO)
    I connect and retreive a recordset from the DB. OK
    Then I call MyDll with rs as the parameter as follows:

    Code:
    Dim rs As ADODB.Recordset
    Set rs=New ADODB.Recordset
    
    'Get Recordset
    rs.open "SELECT * FROM Table1",cnn
    
    'Call Dll with rs as parameter:
    dim obj as Project1.Class1
    Set obj=new Project1.Class1
    
    bool = obj.ReceiveRS(rs)
    Now the Dll:


    Code:
    Public Function ReceiveRS(ByRef RS As ADODB.Recordset) As Boolean
    
    On Error GoTo errHandler
    
    Do Until RS.EOF
        'Do something
        RS.MoveNext
    
    Loop
    
    ReceiveRS = True
    
    Exit Function
    
    errHandler:
    ReceiveRS = False
    
    End Function
    I have references to ADODB on both projects.

    How does this look to you? is this what you are trying to do?



  7. #7

    Thread Starter
    Addicted Member
    Join Date
    Nov 2000
    Location
    Posts
    130
    thanks andre for the detail program...
    i've already manage to solve the problem...
    it's actually nothing to do with the recordset... there's actually error in the dll program... (it's actually built by my colleague and i already re-check the program and inside the procedure, i found out there's error)

    anyway, thank you very much for the detail explaination...

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