Click to See Complete Forum and Search --> : DLL problem... plz advice
serhiy
Jan 16th, 2001, 03:54 AM
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...
André
Jan 16th, 2001, 08:31 AM
How are you sending the recordset? Byref? Byval?
You shold pass it Byref.
I use pass recordsets everyday without any problems.
Public function ReceiveRs(byref Rs as ADODB.Recordset) as boolean
'bla bla bla
end function
André
serhiy
Jan 17th, 2001, 01:18 AM
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...
serhiy
Jan 17th, 2001, 02:04 AM
I've tried it...
but it still gives me the same error...
André
Jan 17th, 2001, 03:13 AM
Can you show me your Method call and Function declaration?
André
André
Jan 17th, 2001, 03:46 AM
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:
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:
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?
serhiy
Jan 17th, 2001, 04:21 AM
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...
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.