|
 |
asp_components thread: Return RecordSet From DLL
Message #1 by "Frankie, Loh Teck Seng" <lohts@p...> on Fri, 1 Dec 2000 17:36:28 +0800
|
|
Greting;
I am trying to have a function in DLL module that specializing in returning
the record and one function in DLL's class module that calling this DLL
module above mentioned. I however encountered the following problems,
wondering whether I can have so called disconnected recordset in the DLL?
Appreciate if someone could give a hand. Thanks.
Class Module in DLL
---------------------
Public Function call_retrieve_records() As ADODB.recordset
call_retrieve_records = HdbDriverMod.retrieve_records(datefrom,
dateto)
End Function
In DLL Module
-------------
Public Function retrieve_records(datefrom As String, dateto As String) As
adodb.recordset
Dim cmd As New adodb.Command
Dim rs As New adodb.recordset
Dim prm As Parameter
Dim cnn As adodb.Connection
Dim ReturnValue As Integer
Set cnn = New adodb.Connection
cnn.Open ConnectionStr()
Dim strSQL As String
strSQL = "SELECT * from street_lib WHERE "
strSQL = strSQL + " datediff(dd, convert(datetime, '" & datefrom & "'),
dte_update) >= 0 "
strSQL = strSQL + " and DateDiff(dd, convert(datetime, '" & dateto &
"'), dte_update) >= 0"
Set rs = New adodb.recordset
rs.CursorType = adOpenKeyset
rs.LockType = adLockOptimistic
rs.Open strSQL, cnn, , , adCmdText
retrieve_records = rs
rs.Close
cnn.Close
End Function
When Make as the DLL, the following problem encountered: Invalid Use of
Property, in call_retrieve_records class module function.
Message #2 by Stephane_Dattenny@D... on Fri, 1 Dec 2000 06:45:08 -0600
|
|
try :
Set call_retrieve_records = HdbDriverMod.retrieve_records(datefrom,dateto) '
DONT FORGET THE <SET> STATEMENT
More, this is the code you must use for a disconnected recordset:
In DLL Module
-------------
Public Function retrieve_records(datefrom As String, dateto As
String) As adodb.recordset
Dim rs As adodb.recordset
Dim cnn As adodb.Connection
Dim ReturnValue As Integer
Set cnn = New adodb.Connection
cnn.Open ConnectionStr()
cnn.CursorLocation = adUseClient ' USED FOR DISCONNECTED RECORDSETS
Dim strSQL As String
strSQL = "SELECT * from street_lib WHERE "
strSQL = strSQL + " datediff(dd, convert(datetime, '" & datefrom & "'),
dte_update) >= 0 "
strSQL = strSQL + " and DateDiff(dd, convert(datetime, '" & dateto &
"'), dte_update) >= 0"
Set rs = New adodb.recordset
rs.Open strSQL, ,adOpenStatic, adLockBatchOptimistic, adCmdText
Set rs.ActiveConnection = nothing ' DISCONNECTS THE RECORDSET
set retrieve_records = rs ' DONT FORGET THE <SET> STATEMENT
rs.Close
cnn.Close
End Function
Best regards / Cordialement
Stephane Dattenny
Dell Computers - EMEA IT - VB and Web developer
Phone: +33 (0)4 99 75 49 88
-----Original Message-----
From: Frankie, Loh Teck Seng [mailto:lohts@p...]
Sent: 01 December 2000 20:16
To: ASP components
Subject: [asp_components] Return RecordSet From DLL
Greting;
I am trying to have a function in DLL module that specializing in
returning
the record and one function in DLL's class module that calling this DLL
module above mentioned. I however encountered the following problems,
wondering whether I can have so called disconnected recordset in the DLL?
Appreciate if someone could give a hand. Thanks.
Class Module in DLL
---------------------
Public Function call_retrieve_records() As ADODB.recordset
call_retrieve_records = HdbDriverMod.retrieve_records(datefrom,
dateto)
End Function
In DLL Module
-------------
Public Function retrieve_records(datefrom As String, dateto As
String) As
adodb.recordset
Dim cmd As New adodb.Command
Dim rs As New adodb.recordset
Dim prm As Parameter
Dim cnn As adodb.Connection
Dim ReturnValue As Integer
Set cnn = New adodb.Connection
cnn.Open ConnectionStr()
Dim strSQL As String
strSQL = "SELECT * from street_lib WHERE "
strSQL = strSQL + " datediff(dd, convert(datetime, '" & datefrom & "'),
dte_update) >= 0 "
strSQL = strSQL + " and DateDiff(dd, convert(datetime, '" & dateto &
"'), dte_update) >= 0"
Set rs = New adodb.recordset
rs.CursorType = adOpenKeyset
rs.LockType = adLockOptimistic
rs.Open strSQL, cnn, , , adCmdText
retrieve_records = rs
rs.Close
cnn.Close
End Function
When Make as the DLL, the following problem encountered: Invalid Use of
Property, in call_retrieve_records class module function.
|
|
 |