- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Has anyone produced a DLL for use in an ASP?
I understand that the functions return types must be Variants. Since I have not done this before, If anyone has a template for doing this I will much appreciate getting it.
Thanks, Tim H
I understand that the functions return types must be Variants. Since I have not done this before, If anyone has a template for doing this I will much appreciate getting it.
Thanks, Tim H
Link Copied
3 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Tim,
ASP pages use VBScript (which is a subset of the full VB language). I'm not a VBScript expert, but as far as I can tell VBScript does not support calling a routine in a DLL. If anyone knows better..., please respond.
Regards,
Leo
ASP pages use VBScript (which is a subset of the full VB language). I'm not a VBScript expert, but as far as I can tell VBScript does not support calling a routine in a DLL. If anyone knows better..., please respond.
Regards,
Leo
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Have a Look at :
http://p2p.wrox.com/archive/beginning_asp/2001-05/13.asp
Which amounts to the following code:
ASP Code (generic class works fine through a sub)
set Generic = Server.CreateObject("MYOBJ.Generic")
Generic.UserID = Request.Form("userid")
Generic.Password = Request.Form("pwd")
Generic.LogIn
session("agency_id") = Generic.AgencyID
session("access_level") = Generic.AccessLevel
set Client = Server.CreateObject("MYOBJ.Client")
Client.UserID = Request.Form("userid")
Client.Password = Request.Form("pwd")
Client.AgencyID = cint(session("agency_id"))
myagency = cint(session("agency_id"))
session("mycontract") = Client.FetchContractor(myagency)
VB DLL:
Public Function FetchContractor(intAgencyID As Integer) As Variant
On Error GoTo ErrorHandler
'Open connection to database
ConnectRstToDatabase
With rst
.Open "Exec SP_ContractorFetchByAgency " & intAgencyID & " "
If .EOF = False Then
FetchContractor = .GetRows
End If
End With
'Clean up and exit
CleanUpResources
Exit Function
ErrorHandler:
Call RaiseError(Err.Number, "FetchContractor", Err.Description)
End Function
http://p2p.wrox.com/archive/beginning_asp/2001-05/13.asp
Which amounts to the following code:
ASP Code (generic class works fine through a sub)
set Generic = Server.CreateObject("MYOBJ.Generic")
Generic.UserID = Request.Form("userid")
Generic.Password = Request.Form("pwd")
Generic.LogIn
session("agency_id") = Generic.AgencyID
session("access_level") = Generic.AccessLevel
set Client = Server.CreateObject("MYOBJ.Client")
Client.UserID = Request.Form("userid")
Client.Password = Request.Form("pwd")
Client.AgencyID = cint(session("agency_id"))
myagency = cint(session("agency_id"))
session("mycontract") = Client.FetchContractor(myagency)
VB DLL:
Public Function FetchContractor(intAgencyID As Integer) As Variant
On Error GoTo ErrorHandler
'Open connection to database
ConnectRstToDatabase
With rst
.Open "Exec SP_ContractorFetchByAgency " & intAgencyID & " "
If .EOF = False Then
FetchContractor = .GetRows
End If
End With
'Clean up and exit
CleanUpResources
Exit Function
ErrorHandler:
Call RaiseError(Err.Number, "FetchContractor", Err.Description)
End Function
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
AFAIK, Leo is correct, ASP doesn't support classic DLLs, just COM objects. The reponses posted at the link Tim gave all seem to be focused on VB ActiveX DLLs (the hint is the Server.CreateObject calls) which are not which are not plain old DLLs.
With CVF, create a COM object using a dual interface and only VARIANT args. That should get you going where you want.
John
With CVF, create a COM object using a dual interface and only VARIANT args. That should get you going where you want.
John

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page