Delphi Pages Forums  

Go Back   Delphi Pages Forums > Delphi Forum > DB-Aware

Lost Password?

Thread Tools Display Modes
Old 11-26-2007, 02:03 PM
delphimpd delphimpd is offline
Senior Member
Join Date: Oct 2006
Posts: 701
Default Email Store Procedure dbo.sp_send_dbmail

Using Delphi 7 and MSSQL2005
Thanks in advance for the Help

I'm trying to implement Email from the SQL2005 Database and the following Link is what I am using to get this feature to work. Perhaps this is good for someone else who wants to implement email in their apps.

Everything is set on the Server Side. Accounts, Profile etc.

All I need is to execute the Store Procedure from My Delphi Application, but I have no idea on how to execute it, since I have never work with store procedures.

I Have two text fields which will hold the parameters to send in the store procedure as follows:

edit_Subject:='Profit reports';

And here is what I need to exceute on my Delphi Store Procedure

Declare @body varchar(100)
set @body1=server :'+@@servername+ 'My First Database Email'
EXEC msdb.dbo.sp_send_dbmail
@recipient = '+edit_receipient,
@subject = '+edit_Subject,
@body = @body1,
@body_format = 'HTML';

Thanks a million in advanced
Reply With Quote
Old 08-20-2009, 11:06 AM
digitiger digitiger is offline
Senior Member
Join Date: Jan 2001
Posts: 716
Lightbulb execute TStoredProc or similar component

Just drop a TStoredProc or similar component (depending on the DB component library you are using) on the form, set its database and StoredProcedure property by supplying appropriate names and as and when you are ready to call the stored procedure maybe button click then you may execute the underlying stored procedure as below:

procedure TForm1.Button1Click(Sender: TObject);
StoredProc1.ParamByName('recipient').Value := edit_receipient.Text;
StoredProc1.ParamByName('Subject').Value := edit_Subject.Text;

Hope it helps.
Reply With Quote

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT. The time now is 08:59 AM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2019, vBulletin Solutions, Inc.