Click to See Complete Forum and Search --> : paging 001+001=002 <> 2


gilgalbiblewhee
02-14-2005, 11:08 PM
I have a database table with field as a three digit number like 001 (I did that because when I was searching for example 1, it would bring all the numbers which included 1, like 1, 10, 11, 12...100...). I have the following so far:

<%pagingurl = "<a href=""thechapter.asp" & "?number=" & rs("chapter")
pagingurl = pagingurl & "&recordType=" & rs("recordType")
If Keyword <> "" then pagingurl = pagingurl & "&Keyword=" & Keyword
If Keyword <> "" then pagingurl = pagingurl & "&Keywordb=" & Keywordb
If Keyword <> "" then pagingurl = pagingurl & "&Keywordc=" & Keywordc
If Keyword <> "" then pagingurl = pagingurl & "&Keywordd=" & Keywordd
If Keyword <> "" then pagingurl = pagingurl & "&Keyworde=" & Keyworde
If Keyword <> "" then pagingurl = pagingurl & "&Keywordf=" & Keywordf
If spoke<> "" then pagingurl = pagingurl & "&spoke=" & spoke


If request.QueryString("book_spoke")="Book_Spoke" then pagingurl = pagingurl & "&book_spoke=Book_Spoke"

If request.QueryString("chapter_spoke")="Chapter_Spoke" then pagingurl = pagingurl & "&chapter_spoke=Chapter_Spoke"

If request.QueryString("verse_spoke")="Verse_Spoke" then pagingurl = pagingurl & "&verse_spoke=Verse_Spoke"

pagingurl = pagingurl & "&text_data=yes"
pagingurl = pagingurl & """>" & rs("book_title") & "&nbsp;" & rs("chap") + 1 & "</a> "

response.write pagingurl%>


<%pagingurl = "<a href=""thechapter.asp" & "?number=" & rs("chapter")
(1st line)
I need to somehow add 001 from rs("chapter") with 001 so that it may equal to 002 and not 2. How can I fix that?

russell
02-15-2005, 01:23 AM
First, though you didn't post your query, i'd say that the search query is wrong, and thats why u made your numeric data a text data type -- should try to avoid that.

but to answer your question try something like:

Dim chapter
Dim nextChapter

chapter = "001"

If Len(chapter) Then
While Left(chapter, 1) = 0
chapter = Mid(chapter, 2, Len(chapter) - 1)
Wend

nextChapter = Right("000" & CStr(chapter + 1), 3)
End If