|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Hi,
I am trying to write a stored procedure that will send an email whenever a certain field in the database is changed. I am using CDO procedures for this. Here is my code (abbreviated) CREATE PROCEDURE dbo.sendMail @from VARCHAR(100), @to VARCHAR(100), @subject VARCHAR(200), @mBody VARCHAR(1000) AS DECLARE @MailID int DECLARE @err int DECLARE @sSource int DECLARE @sDescription VARCHAR(100) DECLARE @sMsg VARCHAR(200) EXEC @err = sp_OACreate 'CDONTS.NewMail', @MailID OUT EXECUTE sp_OAGetErrorInfo @MailID, @sSource OUT, @sDescription OUT SET @sMsg = ' Error # = ' + CAST(@err AS VARCHAR(20)) + '. Description = ' + @sDescription RAISERROR (@sMsg, 16, 1) GO I call this stored procedure through a trigger that looks like this CREATE TRIGGER tr_Categories_1 ON [dbo].[Categories] FOR INSERT, UPDATE, DELETE AS IF UPDATE(CategoryName) BEGIN EXECUTE sendMail 'xyz@abc.com', 'xyz@abc.com', 'Hi there', 'The field has changed' END However, when I update the table I get the following error Server: Msg 50000, Level 16, State 1, Procedure sendMail, Line 16 Error # = -2147221005. Description = Invalid class string I am not sure why I am getting this error, and documentation on the internet is not helping. thanks, varun |
|
#2
|
|||
|
|||
|
Perhaps CDONTS isn't installed on the server?
__________________
====== Doug G ====== I didn't attend the funeral, but I sent a nice letter saying I approved of it. --Mark Twain |
|
#3
|
|||
|
|||
|
Could there be any other reason? I installed CDO yesterday on my computer.
|
|
#4
|
|||
|
|||
|
CDO is not CDONTS, and your code is looking for CDONTS. CDONTS comes with the IIS SMTP server in IIS4 and 5, but isn't installed with XP or W2003.
|
![]() |
| Viewing: ASP Free Forums > Database > Microsoft SQL Server > CDO error |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|