Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Snitz Forums 2000 MOD-Group
 MOD Add-On Forum (W/O Code)
 How to select Topic Subjects on the first letter?
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

ILLHILL
Junior Member

Netherlands
341 Posts

Posted - 07 August 2006 :  21:06:10  Show Profile  Reply with Quote
Don't know if this is the place, but it might come in handy in some mods.

I was wondering how I can select topics starting with a certain letter.
Say, all topics starting with the letter A, how would I go about this?

strSql = strSql & " ORDER BY T.T_SUBJECT ASC"

That's the part to order them in an alphabetic way, but I need
some addition like "if bla bla = "a" then"

Anybody got any experience in this?

Greets & thanks,

Dominic
<

CLPPR.com - All The News Only Seconds Away

JBaldwin
Junior Member

USA
137 Posts

Posted - 07 August 2006 :  21:47:08  Show Profile  Reply with Quote
One way to do it is with the LIKE operator. Depending on which type DB your are using an example would look like this:

strSql = strSql & "WHERE T.T_SUBJECT LIKE 'A%' ORDER BY T.T_SUBJECT ASC"


Sometimes with an MS Access DB you would need to use an asterisk (*)as the wild card operator instead of the percent sign (%):

strSql = strSql & "WHERE T.T_SUBJECT LIKE 'A*' ORDER BY T.T_SUBJECT ASC"


Where 'A%' or 'A*' is the First letter of the subject you want to search for.

Of course this is just one way to do it. I am sure there is a better, more efficient way to go about it. Have a look in members.asp, there is a SQL statement there that uses an initial as a search. I am sure one could rip the snippet out of there and modify it for your needs.<

AbsolutelyFreerolls.com - Poker Freeroll Listings, Poker Forum and Poker News



Edited by - JBaldwin on 07 August 2006 21:52:48
Go to Top of Page

ILLHILL
Junior Member

Netherlands
341 Posts

Posted - 08 August 2006 :  05:07:14  Show Profile  Reply with Quote
Great! Thanks! I will look into this.
Thanks again!

Greets, Dominic
<

CLPPR.com - All The News Only Seconds Away
Go to Top of Page

AnonJr
Moderator

United States
5768 Posts

Posted - 08 August 2006 :  09:26:53  Show Profile  Visit AnonJr's Homepage  Reply with Quote
Just FYI: I use the LIKE operator in a lot of my Access apps at work and the percent sign (%) has worked just fine in all of the ASP-based programs - I haven't used it in any of my desktop apps yet since I'm trying to move almost all our department apps to a web-based system.<
Go to Top of Page

Zuel
Average Member

USA
540 Posts

Posted - 08 August 2006 :  13:23:28  Show Profile  Visit Zuel's Homepage  Reply with Quote
I did this too, except I created an array with all my values. Sample below.


Dim LetterArray : LetterArray = Array("[0-9]", "A", "B", "C", "D", "E", "F", "G", "H", "I", 
"J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z")

For i = 0 to UBound(LetterArray)
    strSql = strSql & "WHERE T.T_SUBJECT LIKE '" & LetterArray(i) & "%' ORDER BY T.T_SUBJECT ASC"
Next


Shows you the posibilities.<

My Completed Mods: News Mod | Zuel's Avatar Add-on
In Development: World of Warcraft Member Roster | [C# Based Forum]

Note - I may take a few days to recieve your email. Hotmail filters all new emails as junk. Would be best to post all questions, concerns in a forum topic to catch my immediate attention. This way others can assist and also correct any similar mistakes.

MSN / E-Mail: ucyimDa_Ruler@Hotmail.com

Personal Bookmarks: How to work a DBS File

Edited by - Zuel on 08 August 2006 13:24:03
Go to Top of Page

ILLHILL
Junior Member

Netherlands
341 Posts

Posted - 08 August 2006 :  15:32:49  Show Profile  Reply with Quote
Thanks guys! Appreciate it!

Greets & thanks,

Dominic
<

CLPPR.com - All The News Only Seconds Away
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.16 seconds. Powered By: Snitz Forums 2000 Version 3.4.07