|
-
Jan 16th, 2001, 04:54 AM
#1
Thread Starter
Addicted Member
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...
-
Jan 16th, 2001, 09:31 AM
#2
Addicted Member
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é
-
Jan 17th, 2001, 02:18 AM
#3
Thread Starter
Addicted Member
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...
-
Jan 17th, 2001, 03:04 AM
#4
Thread Starter
Addicted Member
I've tried it...
but it still gives me the same error...
-
Jan 17th, 2001, 04:13 AM
#5
Addicted Member
Can you show me your Method call and Function declaration?
André
-
Jan 17th, 2001, 04:46 AM
#6
Addicted Member
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?
-
Jan 17th, 2001, 05:21 AM
#7
Thread Starter
Addicted Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|