Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Letter/Alphanumeric Based Paging in ASP

Status
Not open for further replies.

frmorris

Programmer
Aug 4, 2005
22
US
I have an asp page that is linked to a sql server database. At first the page only search by the client's last name, but the user needed to search by client id as well. Well I got the search box to search by the client's last name and client id, but when I did that, it broke the letter based paging. I would really appreciate it if someone would take a look at my code and help me figure out why my based paging is not work. The name of the based paging is strLetter. Thank you in advance.

dim strCombine

strCombine = strLetter & strString & " "

Dim strLike


dim strQuery

if isAdmin then

'Show all clients who have not been closed
strQuery = "Select Clients.ID, Clients.FirstName, Clients.LastName, Clients.Address, Clients.City, Clients.State, Clients.Zip, Clients.Phone, Clients.MentorID, Clients.DistrictID from Clients " & _
"Where " & _
"Clients.isClosed=0 "

else

'Only show new clients who have not yet been assigned a mentor
strQuery = "Select Clients.ID, Clients.FirstName, Clients.LastName, Clients.Address, Clients.City, Clients.State, Clients.Zip, Clients.Phone, Clients.MentorID, Clients.DistrictID from Clients " & _
"Where " & _
"Clients.isClosed=0 and " & _
"Clients.MentorID=0 and " & _
"Clients.DistrictID = " & Session("intDistrictID") & " "

end if


if strString <> "" then
if isNumeric(strString) then

strLike = " Clients.ID = " & strString

strQuery = strQuery & "and " & strLike & " "

else
strLike = " Clients.LastName LIKE '" & strLetter & strString & "%' "

strQuery = strQuery & "and " & strLike & " "
end if

strQuery = strQuery & "Order by Clients.LastName, Clients.FirstName, Clients.ID"

end if

 
my guess is it's in you query string, mainly in the strLike.
try using some Response.write, response.end to spit out what your querystring is.

Ordinary Programmer
 
I've done that. The query displays correctly. For example, if I click on the letter k. The letter k is displayed. However, it will not display the last names that begin with k.
 
Put some Response.Writes after strQuery gets built when you click on a 'k' for example to see exactly what the query looks like that is supposed to pull all people with lastnames starting with 'k'.

[monkey][snake] <.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top