<% 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_id = Null: ox_id = Null x_Name = Null: ox_Name = Null x_Email = Null: ox_Email = Null x_locate = Null: ox_locate = Null x_expectations = Null: ox_expectations = Null x_Comment = Null: ox_Comment = Null x_contacted = Null: ox_contacted = Null %> <% Response.Buffer = True ' Load key from QueryString bCopy = True x_id = Request.QueryString("id") If x_id = "" Or IsNull(x_id) Then bCopy = False End If ' Get action sAction = Request.Form("a_add") If (sAction = "" Or IsNull(sAction)) Then If bCopy Then sAction = "C" ' Copy record Else sAction = "I" ' Display blank record End If Else ' Get fields from form x_id = Request.Form("x_id") x_Name = Request.Form("x_Name") x_Email = Request.Form("x_Email") x_locate = Request.Form("x_locate") x_expectations = Request.Form("x_expectations") x_Comment = Request.Form("x_Comment") x_contacted = Request.Form("x_contacted") End If ' Open connection to the database Set conn = Server.CreateObject("ADODB.Connection") conn.Open xDb_Conn_Str Select Case sAction Case "C": ' 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 "feedbackMSG.asp" End If Case "A": ' Add If AddData() Then ' Add New Record Session("ewmsg") = "Add New Record Successful" conn.Close ' Close Connection Set conn = Nothing Response.Clear Response.Redirect "feedbackMSG.asp" Else End If End Select %> Feedback
Welcome to www.elifeonline.net Editorial Comments. About Livingprojects Media Network Ltd. Speak to us.
Send your Prayer Requests. Services by Livingprojects Media Network Ltd. Christian books
Past Editions of www.elifeonline.net. News about the Church of God. Time to laugh.
Elifeonline.net values your opinion. Please take a few moments to answer the following questions.


Please write the title of the story you are responding to,
your email and your city/country of residence.
Name & country of residence:
Email:
How did you locate this website?
Has this website met with your expectations?
Yes No

What is your comments on the story? Please
quote the title of the story you are reacting
to.

Do you want to be contacted?
Yes No
Please click the SUBMIT button only once,
then allow a few minutes for this process to be completed.
Clicking more than once may result in repeated transactions.
  Don't forget to visit our official home site: www.livingpronetwork.org  
<% 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 [feedback]" sWhere = "" sGroupBy = "" sHaving = "" sOrderBy = "" If sWhere <> "" Then sWhere = sWhere & " AND " sWhere = sWhere & "([id] = " & AdjustSql(x_id) & ")" 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_id = rs("id") x_Name = rs("Name") x_Email = rs("Email") x_locate = rs("locate") x_expectations = rs("expectations") x_Comment = rs("Comment") x_contacted = rs("contacted") End If rs.Close Set rs = Nothing End Function %> <% '------------------------------------------------------------------------------- ' Function AddData ' - Add Data ' - Variables used: field variables Function AddData() Dim sSql, rs, sWhere, sGroupBy, sHaving, sOrderBy Dim bCheckKey, sSqlChk, sWhereChk sSql = "SELECT * FROM [feedback]" sWhere = "" sGroupBy = "" sHaving = "" sOrderBy = "" ' Check for duplicate key bCheckKey = True sWhereChk = sWhere If x_id = "" Or IsNull(x_id) Then bCheckKey = False Else If sWhereChk <> "" Then sWhereChk = sWhereChk & " AND " sWhereChk = sWhereChk & "([id] = " & AdjustSql(x_id) & ")" End If If bCheckKey Then sSqlChk = sSql & " WHERE " & sWhereChk Set rsChk = conn.Execute(sSqlChk) If Not rsChk.Eof Then Session("ewmsg") = "Duplicate value for primary key" rsChk.Close Set rsChk = Nothing AddData = False Exit Function End If rsChk.Close Set rsChk = Nothing End If ' Add New Record If sWhere <> "" Then sWhere = sWhere & " AND " sWhere = sWhere & "(0 = 1)" 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 rs.AddNew ' Field Name sTmp = Trim(x_Name) If Trim(sTmp) = "" Then sTmp = Null rs("Name") = sTmp ' Field Email sTmp = Trim(x_Email) If Trim(sTmp) = "" Then sTmp = Null rs("Email") = sTmp ' Field locate sTmp = Trim(x_locate) If Trim(sTmp) = "" Then sTmp = Null rs("locate") = sTmp ' Field expectations sTmp = Trim(x_expectations) If Trim(sTmp) = "" Then sTmp = Null rs("expectations") = sTmp ' Field Comment sTmp = Trim(x_Comment) If Trim(sTmp) = "" Then sTmp = Null rs("Comment") = sTmp ' Field contacted sTmp = Trim(x_contacted) If Trim(sTmp) = "" Then sTmp = Null rs("contacted") = sTmp rs.Update rs.Close Set rs = Nothing AddData = True End Function %>