SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Guru
    Join Date
    Aug 2004
    Location
    Canada
    Posts
    730
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    need guidance in inserting/updating field ( coding question )

    All I want to insert is the "new_gemetria" field. Is it necessary to enter all the "p_"s as shown below. Since all the rest of the fields are already inserted.
    Code:
        if linkSet.EOF then
            p_new_id = 1
        else
            p_new_id = linkSet("new_id") + 1
        end if
    
        p_new_id_in = Request.querystring("p_new_id")
        if p_new_id_in <> "" then
            linkSet.Find "new_id = " & p_new_id_in
        end if
        if p_new_id_in = "" or linkSet.EOF then
            p_new_recordType = ""
            p_new_book_spoke = ""
            p_new_chapter_spoke = ""
            p_new_verse_spoke = ""
            p_new_book = ""
            p_new_chapter = ""
            p_new_verse = ""
            p_new_text_data = ""
            p_new_gemetria = ""
    
        else
            p_new_id = p_new_id_in
            p_new_recordType = linkSet("new_recordType")
            p_new_book_spoke = linkSet("new_book_spoke")
            p_new_chapter_spoke = linkSet("new_chapter_spoke")
            p_new_verse_spoke = linkSet("new_verse_spoke")
            p_new_book = linkSet("new_book")
            p_new_chapter = linkSet("new_chapter")
            p_new_verse = linkSet("new_verse")
            p_new_text_data = linkSet("new_text_data")
            p_new_gemetria = linkSet("new_gemetria")
            p_existing = p_new_id_in
        end if
    Last edited by gilgalbiblewheel; Apr 19, 2005 at 14:59.
    Compare bible texts (and other tools):
    TheWheelofGod

  2. #2
    Original Gangster silver trophy Thing's Avatar
    Join Date
    Oct 2000
    Location
    Philadelphia, PA
    Posts
    4,708
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Not sure what you mean here. You are setting the variable p_new_gemetria to the form field value of new_gemetria. Explain a little more.

  3. #3
    SitePoint Guru
    Join Date
    Aug 2004
    Location
    Canada
    Posts
    730
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    SQL UPDATE statement problem

    How do I insert this VBScript? Please correct me from the 1st response .write to the "next"

    In case you're wondering, I am inserting some mathematical result from the formula between the 1st response .write to the "next".

    Code:
      TheString = Request.QueryString("new_text_data")
      ArrayTemp = split(TheString, " ")
      NumberOfWords = UBound(ArrayTemp) + 1
    
        SQL = "UPDATE 2"
        SQL = SQL & "SET new_gemetria = "
    
       Response.Write "<P><i>Number of words:</i> " & NumberOfWords
       Response.Write "<BR>Total=" & computeValue(TheString)
      For Each Word In ArrayTemp
       Response.Write "<BR><font size=""5"" face=""BSTHebrew"">" & word & "</font>="
       Response.write computeValue(word)
      next
        SQL = SQL & "WHERE new_text_data = ''"
    And I don't know if this is right but "new_text_data" should be the "new_text_data" of every single record in the table. So I left the '' blank. How should I write that?
    Compare bible texts (and other tools):
    TheWheelofGod

  4. #4
    SitePoint Guru
    Join Date
    Aug 2004
    Location
    Canada
    Posts
    730
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    full coding:

    Code:
    <% Option Explicit 
    
    ' ADO constants used in this page
    Const adOpenForwardOnly = 0
    Const adLockReadOnly = 1
    Const adCmdTableDirect = &H0200
    Const adUseClient = 3
    %>
    <html>
    <head>
      <style>
      body { font-family : Verdana; font-size : 8pt; }
      a { font-family : Verdana; font-size : 8pt; text-decoration : none; }
      </style>
    </head>
    
    <body>
    <%
      Dim connStr
        connStr = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath("hebrewbible.mdb")
    
            Dim ans
            Dim i
            Dim rs
            Dim SQL
            Dim TheString, ArrayTemp, NumberOfWords, Word
    
    function getKeyValue_h(chr)
      //A select statement is more efficient for this
      select case chr
       case "a"
        getKeyValue_h = 1 
       case "b"  
        getKeyValue_h = 2 
       case "g"
        getKeyValue_h = 3 
       case "d"
        getKeyValue_h = 4 
       case "h"
        getKeyValue_h = 5 
       case "w"
        getKeyValue_h = 6 
       case "z"
        getKeyValue_h = 7 
       case "x"
        getKeyValue_h = 8 
       case "j"
        getKeyValue_h = 9 
       case "y"
        getKeyValue_h = 10 
       case "k","$"
        getKeyValue_h = 20 
       case "l"
        getKeyValue_h = 30 
       case "m","~"
        getKeyValue_h = 40 
       case "n","!"
        getKeyValue_h = 50 
       case "s"
        getKeyValue_h = 60 
       case "["
        getKeyValue_h = 70 
       case "p","@"
        getKeyValue_h = 80 
       case "c","#"
        getKeyValue_h = 90 
       case "q"
        getKeyValue_h = 100 
       case "r"
        getKeyValue_h = 200
       case "f","v"
        getKeyValue_h = 300 
       case "t"
        getKeyValue_h = 400
       case else
        getKeyValue_h = 0
      end select
    end function 
    
    function computeValue(str)
      ans = 0
      for i = 0 to len(str)
        ans = ans + getKeyValue_h(mid(str,i+1,1))
      next
      computeValue = ans 
    end function
    
        
    
        Set rs = Server.CreateObject("ADODB.Recordset")
        
        rs.PageSize = 10
        rs.CacheSize = 5
        rs.CursorLocation = adUseClient
    '  TheString = rs("new_text_data")
      TheString = Request.QueryString("new_text_data")
      ArrayTemp = split(TheString, " ")
      NumberOfWords = UBound(ArrayTemp) + 1
        SQL = "UPDATE 2 "
        SQL = SQL & "SET new_gemetria = "
    
    '  Response.Write "<P>The String is: " & TheString
       Response.Write "<P><i>Number of words:</i> " & NumberOfWords
       Response.Write "<BR>Total=" & computeValue(TheString)
    '  Response.Write "<P>Here are the words which compose that string: "
      For Each Word In ArrayTemp
       Response.Write "<BR><font size=""5"" face=""BSTHebrew"">" & word & "</font>="
       Response.write computeValue(word)
      next
        SQL = SQL & "WHERE new_text_data = ''"
    '    SQL = SQL & "ALTER TABLE 2 ADD new_gemetria memo"
    
    
    
        rs.Open SQL, connStr, adOpenForwardOnly, adLockReadOnly, adCmdTableDirect
        
        
        If Len(Request("pagenum")) = 0  Then
    '        rs.AbsolutePage = 1
          Else
            If CInt(Request("pagenum")) <= rs.PageCount Then
                rs.AbsolutePage = Request("pagenum")
              Else
                rs.AbsolutePage = 1
            End If
        End If
        
        Dim abspage, pagecnt
          abspage = rs.AbsolutePage
          pagecnt = rs.PageCount
        
        If Not rs.EOF Then
          Response.Write "PageCount : " & rs.PageCount & "<br>" & vbcrlf
          Response.Write "Absolute Page : " & rs.AbsolutePage & "<br>" & vbcrlf
          
            Response.Write "Total number of records : " & rs.RecordCount & "<br><br>" & vbcrlf
            
            Dim fldF, intRec
            
            Response.Write "<table border=1 align=center cellpadding=3 cellspacing=0><thead><tr>"
            For Each fldF in rs.Fields
              Response.Write "<td>" & fldF.Name & "</td>"
            Next
            Response.Write "</tr></thead><tbody>"
            
            For intRec=1 To rs.PageSize
              If Not rs.EOF Then
                Response.Write "<tr>"
                For Each fldF in rs.Fields
                  Response.Write "<td>" & fldF.Value & "</td>"
                Next
                Response.Write "<tr>"
                rs.MoveNext
              End If
            Next
            Response.Write "</tbody></table><p>"
            
            ' Now showing first, next, back, last buttons.
            Response.Write "<div align=""center"">" & vbcrlf
            Response.Write "<a href=""" & Request.ServerVariables("SCRIPT_NAME") & "?pagenum=1"">First Page</a>"
            Response.Write "&nbsp;|&nbsp;"
            
            If abspage = 1 Then
            Response.Write "<span style=""color:silver;"">Previous Page</span>"
            Else
            Response.Write "<a href=""" & Request.ServerVariables("SCRIPT_NAME") & "?pagenum=" & abspage - 1 & """>Previous Page</a>"
            End If
                    Response.Write "&nbsp;|&nbsp;"
            
            If abspage < pagecnt Then
            Response.Write "<a href=""" & Request.ServerVariables("SCRIPT_NAME") & "?pagenum=" & abspage + 1 & """>Next Page</a>"
            Else
            Response.Write "<span style=""color:silver;"">Next Page</span>"
            End If
            Response.Write "&nbsp;|&nbsp;"
            Response.Write "<a href=""" & Request.ServerVariables("SCRIPT_NAME") & "?pagenum=" & pagecnt & """>Last Page</a>"
            Response.Write "</div>" & vbcrlf
            
        Else
          Response.Write "No records found!"
        End If
                
        rs.Close
        Set rs = Nothing
    %>
    </body>
    </html>
    What it is supposed to do is to take "new_text_data" and convert the letters into numercal values. Then it should add the letters of words together ( the original coding of the functions that do this job are found in http://k.domaindlx.com/gemetria/kjv.asp. To see how it works just type in "bra" in the "look for:" section and press "search". Pressing "Enter" won't work.) So you'll see the results under the "Gemetria value" column. I want to add these values to the database table so that I can "search" those numbers as well.
    Compare bible texts (and other tools):
    TheWheelofGod

  5. #5
    SitePoint Guru
    Join Date
    Aug 2004
    Location
    Canada
    Posts
    730
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    New method to update but need help

    I thought of another method because this seems too complicated. How about including a textarea wherein is the calculation inserted automatically next to each record (therefore a textarea next to each record) and a submit button on top of the "textarea column".

    I tried this but it has some problems:
    since the page holds 10 records at a time what it's doing is taking the result from the 10 records and updating in one record (is one square called parameter?). So 10 in 1.

    Here's the link:
    http://k.domaindlx.com/gemetria/pageing2.asp
    Compare bible texts (and other tools):
    TheWheelofGod


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •