The Forum has been Updated
The code has been upgraded to the latest .NET core version. Please check instructions in the Community Announcements about migrating your account.
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
<
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
<
نوشته شده در
One way to do it is with the LIKE operator. Depending on which type DB your are using an example would look like this:
Sometimes with an MS Access DB you would need to use an asterisk (*)as the wild card operator instead of the percent sign (%):
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.<
Code:
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 (%):
Code:
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.<
آخرین ویرایش توسط
نوشته شده در
Great! Thanks! I will look into this.
Thanks again!
Greets, Dominic
<
Greets, Dominic
<
نوشته شده در
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.<
نوشته شده در
I did this too, except I created an array with all my values. Sample below.
Shows you the posibilities.<
Code:
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
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
آخرین ویرایش توسط
نوشته شده در
Email Member
Message Member
Post Moderation
بارگزاری فایل
If you're having problems uploading, try choosing a smaller image.
پیشنمایش مطلب
Send Topic
Loading...