%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%> <% Dim MM_editCmd Dim MM_editRedirectUrl Dim MM_editAction MM_editAction = CStr(Request.ServerVariables("SCRIPT_NAME")) If (Request.QueryString <> "") Then MM_editAction = MM_editAction & "?" & Server.HTMLEncode(Request.QueryString) End If ' boolean to abort record edit Dim MM_abortEdit MM_abortEdit = false %> <% ' IIf implementation Function MM_IIf(condition, ifTrue, ifFalse) If condition = "" Then MM_IIf = ifFalse Else MM_IIf = ifTrue End If End Function %> <% If (CStr(Request("MM_insert")) = "form1") Then If (Not MM_abortEdit) Then ' execute the insert Set MM_editCmd = Server.CreateObject ("ADODB.Command") MM_editCmd.ActiveConnection = MM_Loja_STRING MM_editCmd.CommandText = "INSERT INTO letreiro (LetreiroNoticia) VALUES (?)" MM_editCmd.Prepared = true MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param1", 203, 1, 536870910, Request.Form("noticia")) ' adLongVarWChar MM_editCmd.Execute MM_editCmd.ActiveConnection.Close End If End If %> <% If (CStr(Request("MM_update")) = "form2") Then If (Not MM_abortEdit) Then ' execute the update Set MM_editCmd = Server.CreateObject ("ADODB.Command") MM_editCmd.ActiveConnection = MM_Loja_STRING MM_editCmd.CommandText = "UPDATE letreiro SET LetreiroNoticia = ? WHERE LetreiroID = ?" MM_editCmd.Prepared = true MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param1", 203, 1, 536870910, Request.Form("noticia")) ' adLongVarWChar MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param2", 5, 1, -1, MM_IIF(Request.Form("MM_recordId"), Request.Form("MM_recordId"), null)) ' adDouble MM_editCmd.Execute MM_editCmd.ActiveConnection.Close ' append the query string to the redirect URL MM_editRedirectUrl = "letreiro.asp" If (Request.QueryString <> "") Then If (InStr(1, MM_editRedirectUrl, "?", vbTextCompare) = 0) Then MM_editRedirectUrl = MM_editRedirectUrl & "?" & Request.QueryString Else MM_editRedirectUrl = MM_editRedirectUrl & "&" & Request.QueryString End If End If Response.Redirect(MM_editRedirectUrl) End If End If %> <% ' *** Delete Record: construct a sql delete statement and execute it If (CStr(Request("MM_delete")) = "form3" And CStr(Request("MM_recordId")) <> "") Then If (Not MM_abortEdit) Then ' execute the delete Set MM_editCmd = Server.CreateObject ("ADODB.Command") MM_editCmd.ActiveConnection = MM_Loja_STRING MM_editCmd.CommandText = "DELETE FROM letreiro WHERE letreiroID = ?" MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param1", 5, 1, -1, Request.Form("MM_recordId")) ' adDouble MM_editCmd.Execute MM_editCmd.ActiveConnection.Close ' append the query string to the redirect URL MM_editRedirectUrl = "letreiro.asp" If (Request.QueryString <> "") Then If (InStr(1, MM_editRedirectUrl, "?", vbTextCompare) = 0) Then MM_editRedirectUrl = MM_editRedirectUrl & "?" & Request.QueryString Else MM_editRedirectUrl = MM_editRedirectUrl & "&" & Request.QueryString End If End If Response.Redirect(MM_editRedirectUrl) End If End If %> <% Dim Recordset1 Dim Recordset1_cmd Dim Recordset1_numRows Set Recordset1_cmd = Server.CreateObject ("ADODB.Command") Recordset1_cmd.ActiveConnection = MM_Loja_STRING Recordset1_cmd.CommandText = "SELECT * FROM letreiro" Recordset1_cmd.Prepared = true Set Recordset1 = Recordset1_cmd.Execute Recordset1_numRows = 0 %> <% Dim Recordset2__MMColParam Recordset2__MMColParam = "-1" If (Request.QueryString("id") <> "") Then Recordset2__MMColParam = Request.QueryString("id") End If %> <% Dim Recordset2 Dim Recordset2_cmd Dim Recordset2_numRows Set Recordset2_cmd = Server.CreateObject ("ADODB.Command") Recordset2_cmd.ActiveConnection = MM_Loja_STRING Recordset2_cmd.CommandText = "SELECT * FROM letreiro WHERE LetreiroID = ?" Recordset2_cmd.Prepared = true Recordset2_cmd.Parameters.Append Recordset2_cmd.CreateParameter("param1", 5, 1, -1, Recordset2__MMColParam) ' adDouble Set Recordset2 = Recordset2_cmd.Execute Recordset2_numRows = 0 %> <% Dim Repeat1__numRows Dim Repeat1__index Repeat1__numRows = -1 Repeat1__index = 0 Recordset1_numRows = Recordset1_numRows + Repeat1__numRows %>
ID |
Noticia | Editar |
Excluir |
<%=(Recordset1.Fields.Item("LetreiroID").Value)%> |
<%=(Recordset1.Fields.Item("LetreiroNoticia").Value)%> |