<%@ LCID = 3081 %> <% Response.expires = 0 Response.expiresabsolute = Now() - 1 Response.addHeader "pragma", "no-cache" Response.addHeader "cache-control", "private" Response.addHeader "cache-control", "no-cache" Response.addHeader "cache-control", "no-store" 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_VENUE_CODE = Null: ox_VENUE_CODE = Null x_CREDITOR_CODE = Null: ox_CREDITOR_CODE = Null x_VENUE_NAME = Null: ox_VENUE_NAME = Null x_ADDRESS_1 = Null: ox_ADDRESS_1 = Null x_ADDRESS_2 = Null: ox_ADDRESS_2 = Null x_ADDRESS_3 = Null: ox_ADDRESS_3 = Null x_ADDRESS_4 = Null: ox_ADDRESS_4 = Null x_POST_CODE = Null: ox_POST_CODE = Null x_COUNTRY = Null: ox_COUNTRY = Null x_PHONE_NUMBER = Null: ox_PHONE_NUMBER = Null x_FAX_NUMBER = Null: ox_FAX_NUMBER = Null x_CONTACT_NAME = Null: ox_CONTACT_NAME = Null x_EMAIL_ADDRESS = Null: ox_EMAIL_ADDRESS = Null x_ROOM_NAME = Null: ox_ROOM_NAME = Null x_DFRECNUM = Null: ox_DFRECNUM = Null %> <% Response.Buffer = True ' Load Key Parameters sKey = "": bSingleDelete = True x_VENUE_CODE = Request.QueryString("VENUE_CODE") If x_VENUE_CODE <> "" Then If sKey <> "" Then sKey = sKey & "," sKey = sKey & x_VENUE_CODE Else bSingleDelete = False End If If Not bSingleDelete Then sKey = Request.Form("key_d") End If If sKey = "" Or IsNull(sKey) Then Response.Redirect "VENUESlist.asp" arRecKey = Split(sKey&"", ",") i = 0 Do While i <= UBound(arRecKey) sDbWhere = sDbWhere & "(" ' Remove spaces sRecKey = Trim(arRecKey(i+0)) ' Build the SQL sDbWhere = sDbWhere & "[VENUE_CODE]='" & AdjustSql(sRecKey) & "' AND " If Right(sDbWhere, 5) = " AND " Then sDbWhere = Left(sDbWhere, Len(sDbWhere)-5) & ") OR " i = i + 1 Loop If Right(sDbWhere, 4) = " OR " Then sDbWhere = Left(sDbWhere, Len(sDbWhere)-4) ' Get action sAction = Request.Form("a_delete") If sAction = "" Or IsNull(sAction) Then sAction = "I" ' Display record 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 "VENUESlist.asp" End If Case "D": ' Delete If DeleteData(sDbWhere) Then Session("ewmsg") = "Delete Successful" conn.Close ' Close Connection Set conn = Nothing Response.Clear Response.Redirect "VENUESlist.asp" End If End Select %>

Delete from TABLE: VENUES

Back to List

<% nRecCount = 0 i = 0 Do While i <= UBound(arRecKey) nRecCount = nRecCount + 1 ' Set row color sItemRowClass = " bgcolor=""#FFFFFF""" ' Display alternate color for rows If nRecCount Mod 2 <> 0 Then sItemRowClass = " bgcolor=""#F5F5F5""" End If sRecKey = Trim(arRecKey(i+0)) x_VENUE_CODE = sRecKey If LoadData() Then %> > <% End If i = i + 1 Loop %>
VENUE CODE CREDITOR CODE VENUE NAME ADDRESS 1 ADDRESS 2 ADDRESS 3 ADDRESS 4 POST CODE COUNTRY PHONE NUMBER FAX NUMBER CONTACT NAME EMAIL ADDRESS ROOM NAME DFRECNUM
<% Response.Write x_VENUE_CODE %> <% If Not IsNull(x_CREDITOR_CODE) Then sSqlWrk = "SELECT [CREDITOR_NAME] FROM [CRSMAST]" sTmp = x_CREDITOR_CODE sSqlWrk = sSqlWrk & " WHERE [CREDITOR_CODE] = '" & AdjustSql(sTmp) & "'" sSqlWrk = sSqlWrk & " ORDER BY [CREDITOR_NAME] Asc" Set rswrk = conn.Execute(sSqlWrk) If Not rswrk.Eof Then sTmp = rswrk("CREDITOR_NAME") End If rswrk.Close Set rswrk = Nothing Else sTmp = Null End If ox_CREDITOR_CODE = x_CREDITOR_CODE ' Backup Original Value x_CREDITOR_CODE = sTmp %> <% Response.Write x_CREDITOR_CODE %> <% x_CREDITOR_CODE = ox_CREDITOR_CODE ' Restore Original Value %> <% Response.Write x_VENUE_NAME %> <% Response.Write x_ADDRESS_1 %> <% Response.Write x_ADDRESS_2 %> <% Response.Write x_ADDRESS_3 %> <% Response.Write x_ADDRESS_4 %> <% Response.Write x_POST_CODE %> <% Response.Write x_COUNTRY %> <% Response.Write x_PHONE_NUMBER %> <% Response.Write x_FAX_NUMBER %> <% Response.Write x_CONTACT_NAME %> <% Response.Write x_EMAIL_ADDRESS %> <% Response.Write x_ROOM_NAME %> <% Response.Write x_DFRECNUM %>

<% conn.Close ' Close Connection Set conn = Nothing %> <% '------------------------------------------------------------------------------- ' Function LoadData ' - Load Data based on Key Value ' - Variables setup: field variables Function LoadData() Dim sSql, rs, sWhere, sGroupBy, sHaving, sOrderBy sSql = "SELECT * FROM [VENUES]" sWhere = "" sGroupBy = "" sHaving = "" sOrderBy = "" If sWhere <> "" Then sWhere = sWhere & " AND " sWhere = sWhere & "([VENUE_CODE] = '" & AdjustSql(x_VENUE_CODE) & "')" sSql = sSql & " WHERE " & sWhere 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_VENUE_CODE = rs("VENUE_CODE") x_CREDITOR_CODE = rs("CREDITOR_CODE") x_VENUE_NAME = rs("VENUE_NAME") x_ADDRESS_1 = rs("ADDRESS_1") x_ADDRESS_2 = rs("ADDRESS_2") x_ADDRESS_3 = rs("ADDRESS_3") x_ADDRESS_4 = rs("ADDRESS_4") x_POST_CODE = rs("POST_CODE") x_COUNTRY = rs("COUNTRY") x_PHONE_NUMBER = rs("PHONE_NUMBER") x_FAX_NUMBER = rs("FAX_NUMBER") x_CONTACT_NAME = rs("CONTACT_NAME") x_EMAIL_ADDRESS = rs("EMAIL_ADDRESS") x_ROOM_NAME = rs("ROOM_NAME") x_DFRECNUM = rs("DFRECNUM") 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 [VENUES]" 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 [VENUES]" 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 %>