<%@ Import Namespace="System.Data.SqlClient" %> <%@ Import Namespace="System.Data" %>
<% Dim rs As SqlDataReader Dim cmd As SqlCommand Dim DataConn As SqlConnection 'Check if the session timed out, if so get where the user wanted to go so we can go there after the refresh. If Session("DataConn_ConnectionString") = "" Then 'This session really only applies to syndicated events [new format], and email send to friend requests. Session("GoToHere") = Request.FilePath.Substring(Request.FilePath.LastIndexOf("/") + 1) & Request.Url.Query.ToString Response.Redirect("default.aspx") End If 'Get the notification id passed in the quesry string. Dim ntfidn As String = request.QueryString.Item("ntfidn") Dim EName as String = request.QueryString.Item("ename") DataConn = New SqlConnection(session("DataConn_ConnectionString")) cmd = New SqlCommand cmd.Connection = DataConn If Not IsNumeric(ntfidn) Then Response.Write("The event notification to removed is not valid." & "") Else 'If the querystring contains an email address, the user wants to stop receiving ALL notifications 'otherwise, only the one indicated by the notification id If Not IsNothing(request.querystring("remove")) Then cmd.CommandText = "DELETE FROM Event_Notification WHERE EmailAddress=@remove" cmd.Parameters.AddWithValue("@remove", Request.QueryString("remove").Trim()) Try 'Get the event name for the event to stop being notified on. 'Delete the row from the calendar Notification system DataConn.Open() cmd.ExecuteNonQuery() DataConn.Close() Response.Write("The email address " & request.querystring("remove") & " will no longer receive notifications for any events." & "") Catch ex As Exception 'The row could not be deleted. End Try Else cmd.CommandText = "DELETE FROM Event_Notification WHERE EventNotificationID=@ntfidn" cmd.Parameters.AddWithValue("@ntfidn", ntfidn) Try 'Get the event name for the event to stop being notified on. 'Delete the row from the calendar Notification system DataConn.Open() cmd.ExecuteNonQuery() DataConn.Close() Response.Write("You will no longer receive notifications for the event:
" & EName & "") Catch ex As Exception 'The row could not be deleted. End Try End If End If %>