<% 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_Names = Null: ox_Names = Null x_phonenumbers = Null: ox_phonenumbers = Null x_Email = Null: ox_Email = Null x_PrayerRequest1 = Null: ox_PrayerRequest1 = Null x_PrayerRequest2 = Null: ox_PrayerRequest2 = Null x_PrayerRequest3 = Null: ox_PrayerRequest3 = 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_Names = Request.Form("x_Names") x_phonenumbers = Request.Form("x_phonenumbers") x_Email = Request.Form("x_Email") x_PrayerRequest1 = Request.Form("x_PrayerRequest1") x_PrayerRequest2 = Request.Form("x_PrayerRequest2") x_PrayerRequest3 = Request.Form("x_PrayerRequest3") 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 "prayerMSG.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 "prayerMSG.asp" Else End If End Select %> prayer_room


Submit your URGENT 3 Prayer Requests.
These Requests would be published here for Christians to pray for you.
Every request sent to us receives loving, compassionate attention.
Please know that we are here for you and that you are never alone.
Names
phone numbers.
Email
Fill in Three Prayer Requests
Prayer Request 1
Prayer Request 2
Prayer Request 3
May God hear your prayer, Amen.

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.


Pray for someone today
February, 2010
Mon
Tue
Wed
Thurs
Fri
Sat
Sun
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
29
<% 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 [prayer]" 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_Names = rs("Names") x_phonenumbers = rs("phonenumbers") x_Email = rs("Email") x_PrayerRequest1 = rs("PrayerRequest1") x_PrayerRequest2 = rs("PrayerRequest2") x_PrayerRequest3 = rs("PrayerRequest3") 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 [prayer]" 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 Names sTmp = Trim(x_Names) If Trim(sTmp) = "" Then sTmp = Null rs("Names") = sTmp ' Field phonenumbers sTmp = Trim(x_phonenumbers) If Trim(sTmp) = "" Then sTmp = Null rs("phonenumbers") = sTmp ' Field Email sTmp = Trim(x_Email) If Trim(sTmp) = "" Then sTmp = Null rs("Email") = sTmp ' Field PrayerRequest1 sTmp = Trim(x_PrayerRequest1) If Trim(sTmp) = "" Then sTmp = Null rs("PrayerRequest1") = sTmp ' Field PrayerRequest2 sTmp = Trim(x_PrayerRequest2) If Trim(sTmp) = "" Then sTmp = Null rs("PrayerRequest2") = sTmp ' Field PrayerRequest3 sTmp = Trim(x_PrayerRequest3) If Trim(sTmp) = "" Then sTmp = Null rs("PrayerRequest3") = sTmp rs.Update rs.Close Set rs = Nothing AddData = True End Function %>