View Full Version : need guidance in inserting field ( coding question )
gilgalbiblewhee
04-10-2005, 12:02 AM
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.
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
Bullschmidt
04-13-2005, 09:56 AM
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.
If you're editing a record you only need to deal with whatever field you want to change on that record.
gilgalbiblewhee
04-16-2005, 12:42 AM
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".
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?
miranda
04-16-2005, 07:47 AM
If you are adding the same info to each record in the table then you dont need the Where statement. Now if each record in the table gets a unique value added then you need to loop through the table after you perform your operation. In the example below UniqueIdentifier is variable holding whatever primary key is in your table, since it is used in your where clause I am assuming it is the field new_text_data. In this example it is shown as an integer so no single quates surround it. If it is text then add the single quotes '" & UniqueIdentifier & "'"
like this
Conn = Server.CreateObject("ADODB.Connection")
Conn.Open "Your connection string"
SET RS = Conn.Execute("SELECT * FROM 2")
Do Until RS.EOF
UniqueIdentifier = "" 'clears the variable
UniqueIdentifier = RS("new_text_data ")
TheString = Request.QueryString("new_text_data")
ArrayTemp = split(TheString, " ")
NumberOfWords = UBound(ArrayTemp) + 1
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 = "UPDATE 2 SET new_gemetria = '" & NumberOfWords & "' WHERE new_text_data = " & UniqueIdentifier & ""
Rs.Movenext
Loop
gilgalbiblewhee
04-16-2005, 11:42 PM
it's the same formula but the info or answer varies from record to record.
miranda
04-17-2005, 06:34 AM
ok thats what i thought. This is also why you loop through the database and apply the results for each record. Does the info come from a field in the databse? If so just call your function inside the loop on the correct field. If you showed more complete code I could have given you working example, I am not quite sure though what exactly you are trying to update with the little bit of information you gave.
gilgalbiblewhee
04-17-2005, 11:33 PM
<% 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 " | "
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 " | "
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 " | "
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>
miranda
04-18-2005, 03:43 AM
OK I admit it. Now I am really confused. You have an update statement and then have paging with no select statement to page through. An UPDATE will not display any records to the page.
But first things first, you need to open a connection to the database before you can do anything. The connection string (connStr) just points out what type of database it is, and where the database is located. So you need to assign a connection object, then open it. Using VB naming conventions I named the connection object objConn. This is assigned and then opened like so:
Set objConn = Server.CreateObject("ADODB.Connection")
objConn.Open connStr
Now with the code you are showing your WHERE statement would be
WHERE new_text_data = '" & TheString & "'"
Also I don't understand why you did this
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 = '" & TheString & "'"
You have not put any info into the new_gemetria field. Instead all you did was write it to the screen. Unless you thought that what you are writing to the screen will update to the database. If so, then no, it will not. Now what exactly do you want in the new_gemetria field? Everything you were writing to the screen? If yes then you need to declare a variable and assign this information to the variable.
If that is what you wanted to do then this does exactly the same thing but makes the code easier to read
Dim strNewGemetria
strNewGemetria = "<P><i>Number of words:</i> " & NumberOfWords &_
strNewGemetria = strNewGemetria & "<BR>Total=" & computeValue(TheString)
For Each Word In ArrayTemp
strNewGemetria = strNewGemetria & "<BR><font size=""5"" face=""BSTHebrew"">" & word & "</font>="
strNewGemetria = strNewGemetria & computeValue(word)
next
SQL = "UPDATE 2 "
SQL = SQL & "SET new_gemetria = '" & strNewGemetria & '"
SQL = SQL & "WHERE new_text_data = "' & TheString & "'"
Now since you are running an update statement there is no need to use an Ado Recordset object. Also since this is an UPDATE there is no need for the pagination code because NOTHING will display on the screen without using a SELECT statement.
So to update the record(s) use this
<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, ans, i, rs, SQL, objConn
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
Dim strNewGemetria
strNewGemetria = "<P><i>Number of words:</i> " & NumberOfWords &_
strNewGemetria = strNewGemetria & "<BR>Total=" & computeValue(TheString)
For Each Word In ArrayTemp
strNewGemetria = strNewGemetria & "<BR><font size=""5"" face=""BSTHebrew"">" & word & "</font>="
strNewGemetria = strNewGemetria & computeValue(word)
next
SQL = "UPDATE 2 "
SQL = SQL & "SET new_gemetria = '" & strNewGemetria & '"
SQL = SQL & " WHERE new_text_data = '" & TheString & "'"
connStr = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath("hebrewbible.mdb")
Set objConn = Server.CreateObject("ADODB.Connection")
objConn.Open connStr
SET rs = objConn.Execute(SQL)
If err.Number = 0 Then
Response.Write "The record(s) have been updated"
Else
Response.Write "There was an error<br>"
Response.Write err.Number & "<br>" & err.Description
End If
Set rs = Nothing
objConn.Close
Set objConn = Nothing
%>
</body>
</html>
Note that since i didnt open a recordset object there was no need to use rs.close simply releasing it from memory using Set rs = Nothing will suffice. However, I then closed the connection object and released it from memory as well.
I hope that helps. If you have any more questions feel free to ask.
gilgalbiblewhee
04-20-2005, 01:35 AM
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
miranda
04-20-2005, 05:34 AM
I think you are making this much more complicated than it needs to be. Do you want to update all records? Then simply do something like this
Dim connStr, ans, i, rs, SQL, objConn
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
connStr = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath("hebrewbible.mdb")
Set objConn = Server.CreateObject("ADODB.Connection")
objConn.Open connStr
Set rs = Server.Execute("SELECT * FROM 2")
If Not rs.EOF Then
Dim strNewGemetria
Do Until rs.EOF
TheString = rs("new_text_data")
strNewGemetria = "<P><i>Number of words:</i> " & NumberOfWords &_
strNewGemetria = strNewGemetria & "<BR>Total=" & computeValue(TheString)
For Each Word In ArrayTemp
strNewGemetria = strNewGemetria & "<BR><font size=""5"" face=""BSTHebrew"">" & word & "</font>="
strNewGemetria = strNewGemetria & computeValue(word)
Next
SQL = "UPDATE 2 "
SQL = SQL & "SET new_gemetria = '" & strNewGemetria & '"
SQL = SQL & " WHERE new_text_data = '" & TheString & "'"
objConn.Execute(SQL)
If err.Number = 0 Then
Response.Write TheString & " has been updated"
Else
Response.Write "There was an error updating " & TheString & "<br>"
Response.Write err.Number & "<br>" & err.Description
End If
Rs.MoveNext
TheString = "" ' clear the value after each iteration
Loop
End If
Set rs = Nothing
objConn.Close
Set objConn = Nothing
This will look at each record, update it, and move on to the next record until it has gone through them all.
gilgalbiblewhee
04-20-2005, 04:05 PM
Server object error 'ASP 0231 : 80004005'
Server.Execute Error
/gemetria/pageing4.asp, line 69
Invalid URL form or fully-qualified absolute URL was used. Use relative URLs.
What does that mean?
miranda
04-20-2005, 05:30 PM
server.execute doesn't work with querystrings. Since you can only transfer to, or execute, ASP pages on the same application, there is no reason to use a fully qualified URL. If you need to go to a server (even if it's the same machine) by a different domain name, use Response.Redirect.
gilgalbiblewhee
04-20-2005, 06:10 PM
Oh do you mean I need to redirect it back to the former page?
gilgalbiblewhee
04-20-2005, 06:16 PM
Check the red section:
<%
'http://www.codingforums.com/showthread.php?p=299681#post299681
Dim connStr, ans, i, rs, SQL, objConn
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
connStr = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath("hebrewbible.mdb")
Set objConn = Server.CreateObject("ADODB.Connection")
objConn.Open connStr
Response.redirect ("pageing.asp") 'this doesnt work out
Set rs = Server.Execute("SELECT * FROM 2")
If Not rs.EOF Then
Dim strNewGemetria
Do Until rs.EOF
TheString = rs("new_text_data")
strNewGemetria = "<P><i>Number of words:</i> " & NumberOfWords &_
strNewGemetria = strNewGemetria & "<BR>Total=" & computeValue(TheString)
For Each Word In ArrayTemp
strNewGemetria = strNewGemetria & "<BR><font size=""5"" face=""BSTHebrew"">" & word & "</font>="
strNewGemetria = strNewGemetria & computeValue(word)
Next
SQL = "UPDATE 2 "
SQL = SQL & "SET new_gemetria = '" & strNewGemetria & "'"
SQL = SQL & " WHERE new_text_data = '" & TheString & "'"
objConn.Execute(SQL)
If err.Number = 0 Then
Response.Write TheString & " has been updated"
Else
Response.Write "There was an error updating " & TheString & "<br>"
Response.Write err.Number & "<br>" & err.Description
End If
Rs.MoveNext
TheString = "" ' clear the value after each iteration
Loop
End If
Set rs = Nothing
objConn.Close
Set objConn = Nothing%>
miranda
04-20-2005, 07:27 PM
Unless you have everything in sub routines and functions, code is executed in order from the top of the page down. So you cannot put a response.Redirect or server.transfer before the rest of the code is completed!! When you call either of those, nothing after that reaches the server because it has already reponded to the request to change page. So finish whatever you need done before you use either of those.
<%
Dim connStr, ans, i, rs, SQL, objConn
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
connStr = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath("hebrewbible.mdb")
Set objConn = Server.CreateObject("ADODB.Connection")
objConn.Open connStr
Set rs = Server.Execute("SELECT * FROM 2")
If Not rs.EOF Then
Dim strNewGemetria
Do Until rs.EOF
TheString = rs("new_text_data")
strNewGemetria = "<P><i>Number of words:</i> " & NumberOfWords &_
strNewGemetria = strNewGemetria & "<BR>Total=" & computeValue(TheString)
For Each Word In ArrayTemp
strNewGemetria = strNewGemetria & "<BR><font size=""5"" face=""BSTHebrew"">" & word & "</font>="
strNewGemetria = strNewGemetria & computeValue(word)
Next
SQL = "UPDATE 2 "
SQL = SQL & "SET new_gemetria = '" & strNewGemetria & "'"
SQL = SQL & " WHERE new_text_data = '" & TheString & "'"
objConn.Execute(SQL)
If err.Number <> 0 Then
Response.Write "There was an error updating " & TheString & "<br>"
Response.Write err.Number & "<br>" & err.Description
End If
Rs.MoveNext
TheString = "" ' clear the value after each iteration
Loop
End If
Set rs = Nothing
objConn.Close
Set objConn = Nothing
Response.redirect ("pageing.asp") 'this must go at the end of all other code to allow the other code to complete
%>
gilgalbiblewhee
04-20-2005, 07:53 PM
But it comes back to:
Server object error 'ASP 0231 : 80004005'
Server.Execute Error
/gemetria/pageing4.asp, line 69
Invalid URL form or fully-qualified absolute URL was used. Use relative URLs.
miranda
04-20-2005, 11:01 PM
Did you get the error without some type of redirect? ie server.transfer, server.execute, or response.redirect
also what line is line 69?
gilgalbiblewhee
04-20-2005, 11:18 PM
I had placed redirect at the end remember?
Line 69 is:
Set rs = Server.Execute("SELECT * FROM 2")
In red:
<%
'http://www.codingforums.com/showthread.php?p=299681#post299681
Dim connStr, ans, i, rs, SQL, objConn
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
connStr = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath("hebrewbible.mdb")
Set objConn = Server.CreateObject("ADODB.Connection")
objConn.Open connStr
Set rs = Server.Execute("SELECT * FROM 2")
If Not rs.EOF Then
Dim strNewGemetria
Do Until rs.EOF
TheString = rs("new_text_data")
strNewGemetria = "<P><i>Number of words:</i> " & NumberOfWords &_
strNewGemetria = strNewGemetria & "<BR>Total=" & computeValue(TheString)
For Each Word In ArrayTemp
strNewGemetria = strNewGemetria & "<BR><font size=""5"" face=""BSTHebrew"">" & word & "</font>="
strNewGemetria = strNewGemetria & computeValue(word)
Next
SQL = "UPDATE 2 "
SQL = SQL & "SET new_gemetria = '" & strNewGemetria & "'"
SQL = SQL & " WHERE new_text_data = '" & TheString & "'"
objConn.Execute(SQL)
If err.Number <> 0 Then
Response.Write "There was an error updating " & TheString & "<br>"
Response.Write err.Number & "<br>" & err.Description
End If
Rs.MoveNext
TheString = "" ' clear the value after each iteration
Loop
End If
Set rs = Nothing
objConn.Close
Set objConn = Nothing
Response.redirect ("pageing.asp") 'this must go at the end of all other code to allow the other code to complete
%>
miranda
04-20-2005, 11:36 PM
duh!!! I can be so brain dead sometimes...
instead of
Set rs = Server.Execute("SELECT * FROM 2")
it should be
Set rs = objConn.Execute("SELECT * FROM 2")
gilgalbiblewhee
04-21-2005, 08:53 PM
I wasn't able to test it because I ran out of bandwidth.
I wanted to say, braindead, yeah. I know what you mean. THat's what happens when we're in front of the computer too long. It happens to me all the time. I mess up somewhere and get frustrated since I don't know where exactly I messed up. I go to sleep, wake up, and come back and I notice where I messed up.
miranda
04-22-2005, 05:46 AM
Oh, many a night I have gone to bed not knowing how to make something happen that a client wants done, only to wake up in the middle of the night with the solution. I have to laugh when I see people asking which language to learn, then extolling the virtues of one language or technology over the other. I have clients that have sites I wrote in asp 3.0, asp.net, php, and one that had one in cold fusion that I was asked to work on, plus then there is cgi and perl. Not to mention the differences in the different databases used. It would make it so much easier sometimes to spot the simple little errors if everyone used the same technology. Or if we could specialize in only one of them.
Have you thought of testing the scripts locally? then there is no need to worry about bandwidth problems..
gilgalbiblewhee
04-23-2005, 12:20 AM
I got "Object not a collection" on this line:
If Not rs.EOF Then
Dim strNewGemetria
Do Until rs.EOF
TheString = rs("text_data")
' strNewGemetria = "<P><i>Number of words:</i> " & NumberOfWords & "</br>"
For Each Word In ArrayTemp
If iCounter > 0 then
strNewGemetria = strNewGemetria & " + "
End If
'strNewGemetria = strNewGemetria & "<BR><font size=""5"" face=""BSTHebrew"">" & word & "</font>="
strNewGemetria = strNewGemetria & computeValue(word)
Next
strNewGemetria = strNewGemetria & " = " & computeValue(TheString)
SQL = "UPDATE hebrewbibletable "
SQL = SQL & "SET gemetria = '" & strNewGemetria & "'"
SQL = SQL & " WHERE text_data = '" & TheString & "'"
(Do you get paid for ASP coding?)
miranda
04-23-2005, 02:59 AM
You have no value to ArrayTemp as you have it shown. I just assumed you had filled it with a function that you didn't show. You need to assign the values to this array before you can do anything with it. Out of curiosity what is the array supposed to hold?
and Yes, I do get paid for writing asp, asp.net, and php code. Although my husband doesn't think I charge enough, but I do have a list of clients that I do all of the coding for.
gilgalbiblewhee
04-24-2005, 03:23 AM
Do you work on PWS ( Personnal Web Server )?
Because this is what I got:
error 'ASP 0113'
Script timed out
/pageing4.asp
The maximum amount of time for a script to execute was exceeded. You can change this limit by specifying a new value for the property Server.ScriptTimeOut or by changing the value in the IIS administration tools.
miranda
04-24-2005, 05:05 AM
no I don't use PWS, I have IIS and also Cassini for web servers
gilgalbiblewhee
04-25-2005, 07:12 PM
"IIS administration tools". Where is that?
error 'ASP 0113'
Script timed out
/pageing4.asp
The maximum amount of time for a script to execute was exceeded. You can change this limit by specifying a new value for the property Server.ScriptTimeOut or by changing the value in the IIS administration tools.
Also I have:
If Not rs.EOF Then
Dim strNewGemetria
Dim iCounter
Do Until rs.EOF
TheString = rs("text_data")
ArrayTemp = split(TheString, " ")
NumberOfWords = UBound(ArrayTemp) + 1
' strNewGemetria = "<P><i>Number of words:</i> " & NumberOfWords & "</br>"
For Each Word In ArrayTemp
iCounter = 0
If iCounter > 0 then
strNewGemetria = strNewGemetria & " + "
End If
strNewGemetria = strNewGemetria & computeValue(word)
iCounter = iCounter + 1
Next
strNewGemetria = strNewGemetria & " = " & computeValue(TheString)
But the outcome is not what I expexct. I'm looking for a result like this:
123 + 234 + 345 + 567 = 1269
But what I'm getting is this:
123234345567 = 1269
miranda
04-25-2005, 09:56 PM
"IIS administration tools". Where is that?
This is part of IIS and not part of PWS. Which O/S and which webserver do you run? If you have IIS I can help, but if you use PWS then maybe someone else can help you.
But the outcome is not what I expexct. I'm looking for a result like this:
123 + 234 + 345 + 567 = 1269
But what I'm getting is this:
123234345567 = 1269
This is because you change the value of iCounter back to 0 on each loop. You need to make one slight change.
iCounter = 0
For Each Word In ArrayTemp
If iCounter > 0 then
strNewGemetria = strNewGemetria & " + "
End If
strNewGemetria = strNewGemetria & computeValue(word)
iCounter = iCounter + 1
Next
What this does is set the initial value of iCounter to 0, then the value of iCounter will increase on each iteration through the loop.
gilgalbiblewhee
04-26-2005, 01:13 AM
This is part of IIS and not part of PWS. Which O/S and which webserver do you run? If you have IIS I can help, but if you use PWS then maybe someone else can help you.
Windows 98SE
Ok. WHy is it that it gives:
id= 1 257 + 160 + 57 + 43 + 136 + 397 = 1050
55 + 903 + 411 + 61 + 140 + 140 + 55 + 206 + 661 + 441 + 120 + 60 + 293 + 26 + 191 + 278 = 4041
257 + 36 + 26 + 100 + 258 + 160 + 822 + 150 + 356 + 26 + 190 + 407 + 472 + 838 + 187 = 4285...
id= 2 257 + 160 + 57 + 43 + 136 + 397 = 1050
55 + 903 + 411 + 61 + 140 + 140 + 55 + 206 + 661 + 441 + 120 + 60 + 293 + 26 + 191 + 278 = 4041
257 + 36 + 26 + 100 + 258 + 160 + 822 + 150 + 356 + 26 + 190 + 407 + 472 + 838 + 187 = 4285...
id= 3 257 + 160 + 57 + 43 + 136 + 397 = 1050
55 + 903 + 411 + 61 + 140 + 140 + 55 + 206 + 661 + 441 + 120 + 60 + 293 + 26 + 191 + 278 = 4041
257 + 36 + 26 + 100 + 258 + 160 + 822 + 150 + 356 + 26 + 190 + 407 + 472 + 838 + 187 = 4285...
instead of:
id = 1 257 + 160 + 57 + 43 + 136 + 397 = 1050
id = 2 55 + 903 + 411 + 61 + 140 + 140 + 55 + 206 + 661 + 441 + 120 + 60 + 293 + 26 + 191 + 278 = 4041
id = 3 257 + 36 + 26 + 100 + 258 + 160 + 822 + 150 + 356 + 26 + 190 + 407 + 472 + 838 + 187 = 4285 ?
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.