<%@ LCID = 5129 %> <% Response.expires = 0 Response.expiresabsolute = Now() - 1 Response.addHeader "pragma", "no-cache" Response.addHeader "cache-control", "private" Response.CacheControl = "no-cache" %> <% ewCurSec = 0 ' Initialise ' User levels Const ewAllowAdd = 1 Const ewAllowDelete = 2 Const ewAllowEdit = 4 Const ewAllowView = 8 Const ewAllowList = 8 Const ewAllowReport = 8 Const ewAllowSearch = 8 Const ewAllowAdmin = 16 %> <% ' Initialize common variables x_csn = Null x_type = Null x_status = Null x_issue = Null x_card_size = Null x_expiry_date = Null x_issued_date = Null x_issued_at = Null x_issuer = Null x_reissued = Null x_hot = Null x_id = Null %> <% Response.Buffer = True ' Load Key Parameters sKey = Request.querystring("key") If sKey = "" Or IsNull(sKey) Then sKey = Request.Form("key_d") End If arRecKey = Split(sKey&"", ",") ' Single delete record If sKey = "" Or IsNull(sKey) Then Response.Redirect "card_datalist.asp" sDbWhere = sDbWhere & "[csn]='" & Trim(sKey) & "'" ' Get action sAction = Request.Form("a_delete") If sAction = "" Or IsNull(sAction) Then sAction = "I" ' Display with input box End If ' Open connection to the database Set conn = Server.CreateObject("ADODB.Connection") conn.Open xDb_Conn_Str Select Case sAction Case "I": ' Display If LoadRecordCount(sDbWhere) <= 0 Then conn.Close ' Close Connection Set conn = Nothing Response.Clear Response.Redirect "card_datalist.asp" End If Case "D": ' Delete If DeleteData(sDbWhere) Then Session("ewmsg") = "Delete Successful For Key = " & sKey conn.Close ' Close Connection Set conn = Nothing Response.Clear Response.Redirect "card_datalist.asp" End If End Select %>

Delete from TABLE: card data

Back to List

<% nRecCount = 0 For Each sRecKey In arRecKey sRecKey = Trim(sRecKey) nRecCount = nRecCount + 1 ' Set row color sItemRowClass = " class=""ewTableRow""" ' Display alternate color for rows If nRecCount Mod 2 <> 0 Then sItemRowClass = " class=""ewTableAltRow""" End If If LoadData(sRecKey) Then %> > <% End If Next %>
csn type status issue card size expiry date issued date issued at issuer reissued hot id
<% Response.Write x_csn %> <% Response.Write x_type %> <% Response.Write x_status %> <% Response.Write x_issue %> <% Response.Write x_card_size %> <% If IsDate(x_expiry_date) Then Response.Write EW_FormatDateTime(x_expiry_date,7) Else Response.Write x_expiry_date End If %> <% If IsDate(x_issued_date) Then Response.Write EW_FormatDateTime(x_issued_date,7) Else Response.Write x_issued_date End If %> <% Response.Write x_issued_at %> <% Response.Write x_issuer %> <% If x_reissued = True Then sTmp = "Yes" Else sTmp = "No" End If ox_reissued = x_reissued ' Backup Original Value x_reissued = sTmp %> <% Response.Write x_reissued %> <% x_reissued = ox_reissued ' Restore Original Value %> <% If x_hot = True Then sTmp = "Yes" Else sTmp = "No" End If ox_hot = x_hot ' Backup Original Value x_hot = sTmp %> <% Response.Write x_hot %> <% x_hot = ox_hot ' Restore Original Value %> <% Response.Write x_id %>

<% conn.Close ' Close Connection Set conn = Nothing %> <% '------------------------------------------------------------------------------- ' Function LoadData ' - Load Data based on Key Value sKey ' - Variables setup: field variables Function LoadData(sKey) Dim sKeyWrk, sSql, rs, sWhere, sGroupBy, sHaving, sOrderBy sKeyWrk = "'" & AdjustSql(sKey) & "'" sSql = "SELECT * FROM [card_data]" sSql = sSql & " WHERE [csn] = " & sKeyWrk sGroupBy = "" sHaving = "" sOrderBy = "" If sGroupBy <> "" Then sSql = sSql & " GROUP BY " & sGroupBy End If If sHaving <> "" Then sSql = sSql & " HAVING " & sHaving End If If sOrderBy <> "" Then sSql = sSql & " ORDER BY " & sOrderBy End If Set rs = Server.CreateObject("ADODB.Recordset") rs.Open sSql, conn If rs.Eof Then LoadData = False Else LoadData = True rs.MoveFirst ' Get the field contents x_csn = rs("csn") x_type = rs("type") x_status = rs("status") x_issue = rs("issue") x_card_size = rs("card_size") x_expiry_date = rs("expiry_date") x_issued_date = rs("issued_date") x_issued_at = rs("issued_at") x_issuer = rs("issuer") x_reissued = rs("reissued") x_hot = rs("hot") x_id = rs("id") End If rs.Close Set rs = Nothing End Function %> <% '------------------------------------------------------------------------------- ' Function LoadRecordCount ' - Load Record Count based on input sql criteria sqlKey Function LoadRecordCount(sqlKey) Dim sSql, rs, sWhere, sGroupBy, sHaving, sOrderBy sSql = "SELECT * FROM [card_data]" sSql = sSql & " WHERE " & sqlKey sGroupBy = "" sHaving = "" sOrderBy = "" If sGroupBy <> "" Then sSql = sSql & " GROUP BY " & sGroupBy End If If sHaving <> "" Then sSql = sSql & " HAVING " & sHaving End If If sOrderBy <> "" Then sSql = sSql & " ORDER BY " & sOrderBy End If Set rs = Server.CreateObject("ADODB.Recordset") rs.CursorLocation = 3 rs.Open sSql, conn, 1, 2 LoadRecordCount = rs.RecordCount rs.Close Set rs = Nothing End Function %> <% '------------------------------------------------------------------------------- ' Function DeleteData ' - Delete Records based on input sql criteria sqlKey Function DeleteData(sqlKey) Dim sSql, rs, sWhere, sGroupBy, sHaving, sOrderBy sSql = "SELECT * FROM [card_data]" sSql = sSql & " WHERE " & sqlKey sGroupBy = "" sHaving = "" sOrderBy = "" If sGroupBy <> "" Then sSql = sSql & " GROUP BY " & sGroupBy End If If sHaving <> "" Then sSql = sSql & " HAVING " & sHaving End If If sOrderBy <> "" Then sSql = sSql & " ORDER BY " & sOrderBy End If Set rs = Server.CreateObject("ADODB.Recordset") rs.CursorLocation = 3 rs.Open sSql, conn, 1, 2 Do While Not rs.Eof rs.Delete rs.MoveNext Loop rs.Close Set rs = Nothing DeleteData = True End Function %>