%@ 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 from QueryString
x_VENUE_CODE = Request.QueryString("VENUE_CODE")
' Get action
sAction = Request.Form("a_edit")
If sAction = "" Or IsNull(sAction) Then
sAction = "I" ' Display with input box
Else
' Get fields from form
x_VENUE_CODE = Request.Form("x_VENUE_CODE")
x_CREDITOR_CODE = Request.Form("x_CREDITOR_CODE")
x_VENUE_NAME = Request.Form("x_VENUE_NAME")
x_ADDRESS_1 = Request.Form("x_ADDRESS_1")
x_ADDRESS_2 = Request.Form("x_ADDRESS_2")
x_ADDRESS_3 = Request.Form("x_ADDRESS_3")
x_ADDRESS_4 = Request.Form("x_ADDRESS_4")
x_POST_CODE = Request.Form("x_POST_CODE")
x_COUNTRY = Request.Form("x_COUNTRY")
x_PHONE_NUMBER = Request.Form("x_PHONE_NUMBER")
x_FAX_NUMBER = Request.Form("x_FAX_NUMBER")
x_CONTACT_NAME = Request.Form("x_CONTACT_NAME")
x_EMAIL_ADDRESS = Request.Form("x_EMAIL_ADDRESS")
x_ROOM_NAME = Request.Form("x_ROOM_NAME")
x_DFRECNUM = Request.Form("x_DFRECNUM")
End If
' Check if valid key
If x_VENUE_CODE = "" Or IsNull(x_VENUE_CODE) Then Response.Redirect "VENUESlist.asp"
' Open connection to the database
Set conn = Server.CreateObject("ADODB.Connection")
conn.Open xDb_Conn_Str
Select Case sAction
Case "I": ' Get a record to display
If Not LoadData() Then ' Load Record based on key
Session("ewmsg") = "No records found"
conn.Close ' Close Connection
Set conn = Nothing
Response.Clear
Response.Redirect "VENUESlist.asp"
End If
Case "U": ' Update
If EditData() Then ' Update Record based on key
Session("ewmsg") = "Update Record Successful"
conn.Close ' Close Connection
Set conn = Nothing
Response.Clear
Response.Redirect "VENUESlist.asp"
End If
End Select
%>
Edit TABLE: VENUES
Back to List
<%
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 EditData
' - Edit Data based on Key Value
' - Variables used: field variables
Function EditData()
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.CursorLocation = 3
rs.Open sSql, conn, 1, 2
If rs.Eof Then
EditData = False ' Update Failed
Else
' Field VENUE_CODE
sTmp = Trim(x_VENUE_CODE)
If Trim(sTmp) = "" Then sTmp = ""
rs("VENUE_CODE") = sTmp
' Field CREDITOR_CODE
sTmp = Trim(x_CREDITOR_CODE)
If Trim(sTmp) = "" Then sTmp = ""
rs("CREDITOR_CODE") = sTmp
' Field VENUE_NAME
sTmp = Trim(x_VENUE_NAME)
If Trim(sTmp) = "" Then sTmp = ""
rs("VENUE_NAME") = sTmp
' Field ADDRESS_1
sTmp = Trim(x_ADDRESS_1)
If Trim(sTmp) = "" Then sTmp = ""
rs("ADDRESS_1") = sTmp
' Field ADDRESS_2
sTmp = Trim(x_ADDRESS_2)
If Trim(sTmp) = "" Then sTmp = ""
rs("ADDRESS_2") = sTmp
' Field ADDRESS_3
sTmp = Trim(x_ADDRESS_3)
If Trim(sTmp) = "" Then sTmp = ""
rs("ADDRESS_3") = sTmp
' Field ADDRESS_4
sTmp = Trim(x_ADDRESS_4)
If Trim(sTmp) = "" Then sTmp = ""
rs("ADDRESS_4") = sTmp
' Field POST_CODE
sTmp = Trim(x_POST_CODE)
If Trim(sTmp) = "" Then sTmp = ""
rs("POST_CODE") = sTmp
' Field COUNTRY
sTmp = Trim(x_COUNTRY)
If Trim(sTmp) = "" Then sTmp = ""
rs("COUNTRY") = sTmp
' Field PHONE_NUMBER
sTmp = Trim(x_PHONE_NUMBER)
If Trim(sTmp) = "" Then sTmp = ""
rs("PHONE_NUMBER") = sTmp
' Field FAX_NUMBER
sTmp = Trim(x_FAX_NUMBER)
If Trim(sTmp) = "" Then sTmp = ""
rs("FAX_NUMBER") = sTmp
' Field CONTACT_NAME
sTmp = Trim(x_CONTACT_NAME)
If Trim(sTmp) = "" Then sTmp = ""
rs("CONTACT_NAME") = sTmp
' Field EMAIL_ADDRESS
sTmp = Trim(x_EMAIL_ADDRESS)
If Trim(sTmp) = "" Then sTmp = ""
rs("EMAIL_ADDRESS") = sTmp
' Field ROOM_NAME
sTmp = Trim(x_ROOM_NAME)
If Trim(sTmp) = "" Then sTmp = ""
rs("ROOM_NAME") = sTmp
' Field DFRECNUM
rs.Update
EditData = True ' Update Successful
End If
rs.Close
Set rs = Nothing
End Function
%>