Results 1 to 2 of 2

Thread: Calling dll from ASP?

  1. #1
    veebster
    Guest

    Calling dll from ASP?

    Does any one know the syntax for calling the following VB dll in asp i.e. how to send the list of variables? Or how the VB code needs to be changed to be able to be accessed from asp?

    Dim conn As ADODB.Connection
    Dim strSQL As String
    Dim Rst As New ADODB.Recordset

    Private Sub ConnectToDb(DSN$, QuerySQL$)

    Set conn = New ADODB.Connection
    conn.ConnectionString = "Provider=Microsoft.JET.OLEDB.3.51;Data Source=" & DSN$
    conn.Open
    strSQL = QuerySQL$

    Set Rst = conn.Execute(strSQL)

    End Sub

    Public Sub SendEmails(DSN$, QuerySQL$, ServerName$, FromDisplay$, FromAddress$, MsgSubject$, PlainText$, HTMLFile$)

    Dim x%, void%
    Dim SMTP As Object

    ConnectToDb DSN$, QuerySQL$

    Set SMTP = CreateObject("EasyMail.SMTP.5")

    SMTP.MailServer = ServerName$


    Do While Not Rst.EOF

    void% = SMTP.Clear(1 + 2) ' clear recipients and attachments
    SMTP.From = FromDisplay$
    SMTP.FromAddr = FromAddress$

    SMTP.AddRecipient Rst!Name, Rst!email, 1
    SMTP.Subject = MsgSubject$

    'Set body format to HTML
    SMTP.BodyFormat = 1

    'Always set AtuoWrap to zero for HTML messages
    SMTP.AutoWrap = 0

    'Import an HTML file in to the object.
    ret = SMTP.ImportBodyTextEx(HTMLFile$, 2 + 4)
    If Not ret = 0 Then
    Response.Write "Error importing File " & ret
    Exit Sub
    End If

    x% = SMTP.Send
    If x% = 0 Then
    Debug.Print "Message sent successfully to " & Rst!email
    Else
    Debug.Print "There was an error sending your message to " & Rst!email & ". Error: " & CStr(x%)
    End If

    'CallEasyMail ServerName$, FromDisplay$, FromAddress$, Rst!email, MsgSubject$, PlainText$, HTMLFile$
    Rst.MoveNext
    Loop

    Set SMTP = Nothing

    End Sub

    Many thanks

  2. #2
    New Member
    Join Date
    Nov 2001
    Location
    CA
    Posts
    2
    You need to register the DLL in Component Services.

    In your ASP, you can call your DLL

    Set oExample = Server.CreateObject("ProjectName.ClassName")
    oExample.ConnectToDb "YourDNS", "YourSQL"


    Hope this help.

Posting Permissions

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



Click Here to Expand Forum to Full Width