• mbova407 (11/4/2010)


    Good Article. Two suggestions

    I would make the attribute appear in the same code window as the method. At first it looks confusing because you have

    <Microsoft.SqlServer.Server.SqlProcedure()> _

    That ends in a continuation character that goes nowhere.

    Then maybe a little more explanation as to why this attribute is needed.

    Represents an abstraction of the caller's context, which provides access to the SqlPipe, SqlTriggerContext, and WindowsIdentity objects.

    or

    The SqlContext object can be used to obtain the trigger context (for code executing in a trigger) and the pipe object (when available, such as in stored procedures).

    Definitions are taken from the MSDN.

    The Actual VB code should look like this:

    Public Class SQLCLREmail

    <Microsoft.SqlServer.Server.SqlProcedure()> _

    Public Shared Sub SendEmail(ByVal recipients As String _

    , ByVal CC as String _

    , ByVal BCC as String _

    , ByVal subject As String _

    , ByVal from As String _

    , ByVal body As String _

    , ByVal strAttachments as String _

    , ByVal strSMTPServer as String _

    , ByVal strSMTPServerPort as String _

    , ByVal strSMTPServerUser as String _

    , ByVal strSMTPServerPwd as String)

    With the start of the Sub going directly under the Attribute hence the line continuation.