ASP and DLLs??

Results 1 to 2 of 2

Thread: ASP and DLLs??

  1. #1
    Allie Guest

    Default ASP and DLLs??

    Hi,<BR>How do you judge as to what part of ASP script should be written as a Dll?<BR><BR>say i have DLL for establishing connection and get the results from database, then how will my asp script look?<BR>how do I call the DLL?<BR><BR>Thanks,

  2. #2
    David Mann Guest

    Default RE: ASP and DLLs??

    Allie,<BR><BR>Perhaps I can help shed some light on using compiled DLLs in your code. I am assuming that you already have compiled some DLLs and have registered them with your server, so I&#039m going to pick up from this point. <BR><BR>Let&#039s say that you have a DLL to (your example =) create a connection to a database. It sounded like you already made it, so I&#039ll make some more assumptions based on class names, etc. Let&#039s say you made a project in VB called "ConnObj" and the main class file for it is called "ConnClass."<BR><BR>*****Begin ASP File******<BR><BR>&#060;%<BR>Option Explicit<BR><BR>Dim dllObj &#039Object to be used to call the DLL&#039s routines, properties, etc<BR>Dim someVar &#039used to hold data returned from a function<BR>Dim someSqlStmt &#039used to hold a sample SQL query<BR><BR>Set dllObj = Server.CreateObject("ConnObj.ConnClass")<BR><BR>&# 039Just set the above object, dllObj, equal to the dll&#039s project name.class name<BR>&#039Assuming you have a function that returns some sort of info about your data <BR>&#039here is a sample function call from your DLL<BR><BR>someSqlStmt = "select cars from carTable where colour = &#039red&#039"<BR><BR>someVar = dllObj.ProcessDbInfo(someSqlStmt) &#039call the function that belongs to the DLL&#039s class file and pass it a statement.<BR><BR>%&#062;<BR><BR>&#060;!-- in your html output, just use &#060;%=someVar%&#062; for whatever you chose your output to do. --&#062;<BR><BR>I guess this is a rather vague explanation, but I hope it helps you figure out the mechanics of using a DLL. Obviously, there are many more uses than simple function accessing, but that would take a lot of time to explain. I know that there are a few REALLY GOOD articles on 4guys that explain the usages of compiled COM objects, so search for those, too. <BR><BR>Take care, and if there&#039s anything else I can help with, let me know. <BR><BR>Sincerely,<BR> --David<BR><BR><BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts