I got something working, here is my working drill...
best regards...

<begin code behind file>
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Data.OleDb;
using ADODB;

namespace MailWidget
{
        public class SendSqlMail : System.Web.UI.Page
        {
                protected System.Web.UI.WebControls.Button btnSubmit;
        
                private void Page_Load(object sender, 
System.EventArgs e)
                {                       
                
                }

                void btnSubmit_Click(Object sender, EventArgs e)
                {           
            object recordsAffected;                             
                        string strMailRecipient 
= "[EMAIL PROTECTED]";
                        string strConn 
= "Provider=SQLOLEDB.1;Integrated Security=SSPI;Initial 
Catalog=master;Data Source=SqlServerNameGoesHere;";
                        ADODB.Connection Conn=new ADODB.Connection(); 

                        string strSendMail = "master.dbo.xp_sendmail 
@recipients = "
                        + "'" + strMailRecipient + "'" + ", ";
                        strSendMail = strSendMail + "@message = ";
                        strSendMail = strSendMail + "'Your Message',";
                        strSendMail = strSendMail + "@subject = 'Your 
subject'";

                        try                     
                        {                               
                                Conn.Open(strConn,"","",-1);    
                                                                
                                Conn.Execute(strSendMail,out 
recordsAffected, 0);            
                        }                                       
                

                        catch (InvalidCastException er) 
                        {
                                throw(er);
                        }                                       
                                                                
                                                        
                   
                        finally
                        {
                                if (Conn.State == 1)
                                {
                                        Conn.Close();           
                                                                
                                }
                        }                         
                           
                }
                #region Web Form Designer generated code
                override protected void OnInit(EventArgs e)
                {
                        //
                        // CODEGEN: This call is required by the 
ASP.NET Web Form Designer.
                        //
                        InitializeComponent();
                        base.OnInit(e);
                }
                
                /// <summary>
                /// Required method for Designer support - do not 
modify
                /// the contents of this method with the code editor.
                /// </summary>
                private void InitializeComponent()
                {    
                        this.btnSubmit.Click += new 
System.EventHandler(this.btnSubmit_Click);
                        this.Load += new System.EventHandler
(this.Page_Load);

                }
                #endregion
        }
}
</end code behind file>

<start designer file>
<%@ Page language="c#" Codebehind="SendSqlMail.aspx.cs" 
AutoEventWireup="false" Inherits="MailWidget.SendSqlMail" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
        <HEAD>
                <title>WebForm2</title>
                <meta name="GENERATOR" Content="Microsoft Visual 
Studio .NET 7.1">
                <meta name="CODE_LANGUAGE" Content="C#">
                <meta name="vs_defaultClientScript" 
content="JavaScript">
                <meta name="vs_targetSchema" 
content="http://schemas.microsoft.com/intellisense/ie5";>
        </HEAD>
        <body MS_POSITIONING="GridLayout">
                <form id="Form1" method="post" runat="server">
                        <asp:Button id="btnSubmit" style="Z-INDEX: 
101; LEFT: 279px; POSITION: absolute; TOP: 119px"
                                runat="server" 
Text="Button"></asp:Button>
                </form>
        </body>
</HTML>

</end designer file>



------------------------ Yahoo! Groups Sponsor ---------------------~-->
Yahoo! Domains - Claim yours for only $14.70
http://us.click.yahoo.com/Z1wmxD/DREIAA/yQLSAA/saFolB/TM
---------------------------------------------------------------------~->

 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
     http://groups.yahoo.com/group/AspNetAnyQuestionIsOk/

<*> To unsubscribe from this group, send an email to:
     [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
     http://docs.yahoo.com/info/terms/
 

Reply via email to