FaisalHenry
Programmer
I am trying to implement a 3 tier architecture here,
a DLL named DataServices, have a class PassengerData, with a method GetPassengersData that have a Recordset Return type.
The code is listed below:
Public Function getpassengersdata() As ADODB.Recordset
Dim rs As New ADODB.Recordset
Dim cn As New ADODB.Connection
cn.ConnectionString= "Provider=Microsoft.Jet.OLEDB.3.51;" & _
"DataSource=c:\1cruiseline\database\dbcruise.mdb"
cn.Open
rs.Open "qryPassenger", cn
rs.MoveFirst
Set getpassengerdata = rs
End Function
I tried to access the DLL with this code:
Private Sub Command1_Click()
Dim objPassenger As Object
Dim rs As New ADODB.Recordset
Set objPassenger = CreateObject("dataservices.passengerdata"
Set rs = objPassenger.getpassengersdata
rs.MoveFirst
End Sub
at the rs.MoveFirst code i got a run time error 3704, it says that the operation is not allowed if the object is closed
But if i use the rs.Open command, i need a valid connection,
this is not the kind of behavior that i want.
Any suggestion on how to open the RecordSet ?
a DLL named DataServices, have a class PassengerData, with a method GetPassengersData that have a Recordset Return type.
The code is listed below:
Public Function getpassengersdata() As ADODB.Recordset
Dim rs As New ADODB.Recordset
Dim cn As New ADODB.Connection
cn.ConnectionString= "Provider=Microsoft.Jet.OLEDB.3.51;" & _
"DataSource=c:\1cruiseline\database\dbcruise.mdb"
cn.Open
rs.Open "qryPassenger", cn
rs.MoveFirst
Set getpassengerdata = rs
End Function
I tried to access the DLL with this code:
Private Sub Command1_Click()
Dim objPassenger As Object
Dim rs As New ADODB.Recordset
Set objPassenger = CreateObject("dataservices.passengerdata"
Set rs = objPassenger.getpassengersdata
rs.MoveFirst
End Sub
at the rs.MoveFirst code i got a run time error 3704, it says that the operation is not allowed if the object is closed
But if i use the rs.Open command, i need a valid connection,
this is not the kind of behavior that i want.
Any suggestion on how to open the RecordSet ?