Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_databases thread: E-mail (CDONTS)????


Message #1 by "Locke, Darrell (FCS/SFC)" <Darrell.Locke@g...> on Wed, 30 Oct 2002 11:39:11 -0400
Guys,

Quick question, does anyone know how to get a page to fire off an e-mail to
a certain user if one were to delete records from a DB(access)

I have a calendar of events, on this calendar the person can register for
and event. Now, what I like to be able to do, is if this person decides that
he/she cannot make the event that day and decides to delete them from the
register list, that as soon as they hit submit delete button it will fire an
e-mail off to the facilitator of the event. Has anyone done this before?
If so would one mind sharing some code to see how it may work?

Thanks in advance
Darrell
Message #2 by "Drew, Ron" <RDrew@B...> on Wed, 30 Oct 2002 11:20:11 -0500
Did not test this, but this may work...
<%
	Dim DB_CONNECTIONSTRING
	DB_CONNECTIONSTRING =3D "Provider=3DMicrosoft.Jet.OLEDB.4.0;" _
		& "Data Source=3D" & Server.Mappath("your.mdb") & ";"
%>
	<!-- #INCLUDE FILE=3D"adovbs.inc" -->
<%
Dim I               ' Standard looping var
Dim iRecordToDelete ' Id of deleted record
Dim strSQL          ' String variable for building our query
	Set objRecordset =3D Server.CreateObject("ADODB.Recordset")
	iRecordToDelete =3D Request.QueryString("id")
	If IsNumeric(iRecordToDelete) Then
		iRecordToDelete =3D CLng(iRecordToDelete)
	Else
		iRecordToDelete =3D 0
	End If
	strSQL =3D "SELECT * FROM scratch WHERE id=3D" & iRecordToDelete &
";"
	objRecordset.Open strSQL, DB_CONNECTIONSTRING, adOpenKeyset,
adLockPessimistic, adCmdText
	If Not objRecordset.EOF Then
		objRecordset.MoveFirst
		objRecordset.Delete adAffectCurrent
	End If
	If iRecordToDelete <> 0 Then
		Response.Write "Record id " & iRecordToDelete & "
deleted!"
                Body =3D  "EventID : " & iRecordToDelete & " Deleted"
                set objEmail =3D CreateObject("CDONTS.NewMail")
                objEmail.Subject=3D"Event Deleted Info"
                objEmail.From=3D"dummy@y..."
                objEmail.To=3D"youradmin@y..."
                objEmail.Body=3DBody
                objEmail.Send
                set objEmail =3D nothing
	End If
	objRecordset.Close
	Set objRecordset =3D Nothing
%>

-----Original Message-----
From: Locke, Darrell (FCS/SFC) [mailto:Darrell.Locke@g...]
Sent: Wednesday, October 30, 2002 10:39 AM
To: ASP Databases
Subject: [asp_databases] E-mail (CDONTS)????


Guys,

Quick question, does anyone know how to get a page to fire off an e-mail
to a certain user if one were to delete records from a DB(access)

I have a calendar of events, on this calendar the person can register
for and event. Now, what I like to be able to do, is if this person
decides that he/she cannot make the event that day and decides to delete
them from the register list, that as soon as they hit submit delete
button it will fire an e-mail off to the facilitator of the event. Has
anyone done this before? If so would one mind sharing some code to see
how it may work?

Thanks in advance
Darrell

Message #3 by "Locke, Darrell (FCS/SFC)" <Darrell.Locke@g...> on Wed, 30 Oct 2002 13:45:23 -0400
Thanks Ron, I will try it out and modify it to fit, just needed and example
to view.

Thanks buddy
Darrell

-----Original Message-----
From: Drew, Ron [mailto:RDrew@B...] 
Sent: October 30, 2002 12:20 PM
To: ASP Databases
Subject: [asp_databases] RE: E-mail (CDONTS)????

Did not test this, but this may work...
<%
	Dim DB_CONNECTIONSTRING
	DB_CONNECTIONSTRING = "Provider=Microsoft.Jet.OLEDB.4.0;" _
		& "Data Source=" & Server.Mappath("your.mdb") & ";"
%>
	<!-- #INCLUDE FILE="adovbs.inc" -->
<%
Dim I               ' Standard looping var
Dim iRecordToDelete ' Id of deleted record
Dim strSQL          ' String variable for building our query
	Set objRecordset = Server.CreateObject("ADODB.Recordset")
	iRecordToDelete = Request.QueryString("id")
	If IsNumeric(iRecordToDelete) Then
		iRecordToDelete = CLng(iRecordToDelete)
	Else
		iRecordToDelete = 0
	End If
	strSQL = "SELECT * FROM scratch WHERE id=" & iRecordToDelete &
";"
	objRecordset.Open strSQL, DB_CONNECTIONSTRING, adOpenKeyset,
adLockPessimistic, adCmdText
	If Not objRecordset.EOF Then
		objRecordset.MoveFirst
		objRecordset.Delete adAffectCurrent
	End If
	If iRecordToDelete <> 0 Then
		Response.Write "Record id " & iRecordToDelete & "
deleted!"
                Body =  "EventID : " & iRecordToDelete & " Deleted"
                set objEmail = CreateObject("CDONTS.NewMail") 
                objEmail.Subject="Event Deleted Info" 
                objEmail.From="dummy@y..."
                objEmail.To="youradmin@y..."
                objEmail.Body=Body
                objEmail.Send
                set objEmail = nothing
	End If
	objRecordset.Close
	Set objRecordset = Nothing
%>

-----Original Message-----
From: Locke, Darrell (FCS/SFC) [mailto:Darrell.Locke@g...] 
Sent: Wednesday, October 30, 2002 10:39 AM
To: ASP Databases
Subject: [asp_databases] E-mail (CDONTS)????


Guys,

Quick question, does anyone know how to get a page to fire off an e-mail
to a certain user if one were to delete records from a DB(access)

I have a calendar of events, on this calendar the person can register
for and event. Now, what I like to be able to do, is if this person
decides that he/she cannot make the event that day and decides to delete
them from the register list, that as soon as they hit submit delete
button it will fire an e-mail off to the facilitator of the event. Has
anyone done this before? If so would one mind sharing some code to see
how it may work?

Thanks in advance
Darrell


Message #4 by "Drew, Ron" <RDrew@B...> on Wed, 30 Oct 2002 12:52:22 -0500
Good luck...keep in mind, you always need a FROM so I normally use
dummy@m... if I have other information such as the persons email
address deleting the event.

-----Original Message-----
From: Locke, Darrell (FCS/SFC) [mailto:Darrell.Locke@g...]
Sent: Wednesday, October 30, 2002 12:45 PM
To: ASP Databases
Subject: [asp_databases] RE: E-mail (CDONTS)????


Thanks Ron, I will try it out and modify it to fit, just needed and
example to view.

Thanks buddy
Darrell

-----Original Message-----
From: Drew, Ron [mailto:RDrew@B...]
Sent: October 30, 2002 12:20 PM
To: ASP Databases
Subject: [asp_databases] RE: E-mail (CDONTS)????

Did not test this, but this may work...
<%
	Dim DB_CONNECTIONSTRING
	DB_CONNECTIONSTRING =3D "Provider=3DMicrosoft.Jet.OLEDB.4.0;" _
		& "Data Source=3D" & Server.Mappath("your.mdb") & ";"
%>
	<!-- #INCLUDE FILE=3D"adovbs.inc" -->
<%
Dim I               ' Standard looping var
Dim iRecordToDelete ' Id of deleted record
Dim strSQL          ' String variable for building our query
	Set objRecordset =3D Server.CreateObject("ADODB.Recordset")
	iRecordToDelete =3D Request.QueryString("id")
	If IsNumeric(iRecordToDelete) Then
		iRecordToDelete =3D CLng(iRecordToDelete)
	Else
		iRecordToDelete =3D 0
	End If
	strSQL =3D "SELECT * FROM scratch WHERE id=3D" & iRecordToDelete &
";"
	objRecordset.Open strSQL, DB_CONNECTIONSTRING, adOpenKeyset,
adLockPessimistic, adCmdText
	If Not objRecordset.EOF Then
		objRecordset.MoveFirst
		objRecordset.Delete adAffectCurrent
	End If
	If iRecordToDelete <> 0 Then
		Response.Write "Record id " & iRecordToDelete & "
deleted!"
                Body =3D  "EventID : " & iRecordToDelete & " Deleted"
                set objEmail =3D CreateObject("CDONTS.NewMail")
                objEmail.Subject=3D"Event Deleted Info"
                objEmail.From=3D"dummy@y..."
                objEmail.To=3D"youradmin@y..."
                objEmail.Body=3DBody
                objEmail.Send
                set objEmail =3D nothing
	End If
	objRecordset.Close
	Set objRecordset =3D Nothing
%>

-----Original Message-----
From: Locke, Darrell (FCS/SFC) [mailto:Darrell.Locke@g...]
Sent: Wednesday, October 30, 2002 10:39 AM
To: ASP Databases
Subject: [asp_databases] E-mail (CDONTS)????


Guys,

Quick question, does anyone know how to get a page to fire off an e-mail
to a certain user if one were to delete records from a DB(access)

I have a calendar of events, on this calendar the person can register
for and event. Now, what I like to be able to do, is if this person
decides that he/she cannot make the event that day and decides to delete
them from the register list, that as soon as they hit submit delete
button it will fire an e-mail off to the facilitator of the event. Has
anyone done this before? If so would one mind sharing some code to see
how it may work?

Thanks in advance
Darrell




  Return to Index