Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
 All Forums
 Snitz Forums 2000 MOD-Group
 MOD Add-On Forum (W/O Code)
 How to select Topic Subjects on the first letter?

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!
Before posting, make sure you have read this topic!

Screensize:
UserName:
Password:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkInsert EmailInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
   

T O P I C    R E V I E W
ILLHILL Posted - 07 August 2006 : 21:06:10
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
<
5   L A T E S T    R E P L I E S    (Newest First)
ILLHILL Posted - 08 August 2006 : 15:32:49
Thanks guys! Appreciate it!

Greets & thanks,

Dominic
<
Zuel Posted - 08 August 2006 : 13:23:28
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.<
AnonJr Posted - 08 August 2006 : 09:26:53
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.<
ILLHILL Posted - 08 August 2006 : 05:07:14
Great! Thanks! I will look into this.
Thanks again!

Greets, Dominic
<
JBaldwin Posted - 07 August 2006 : 21:47:08
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.<

Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.07 seconds. Powered By: Snitz Forums 2000 Version 3.4.07