Skip to the posts
Buffalo's neighborhood journals since 2003 🍀 Patrick Spicy Devil Logan🌭 Sahlen🥨 Weber Spank🥟 Pierogi🐸 Scaj🍺 Labatt Utica Pink Cherio❄️ Snow Murder

enknot’s journal

🏷️ classic asp

2 posts

Trinary For Classic ASP

· · 🌡️ 49°F

Ok So I lied about what the first one would be, but since I'm working with some code that's useing the topic I'm talking about I have examples.


Ok there's no Trianry operator in Classic ASP. For those of you who don't know what I'm talking about it's this kind of syntax that you can find in most bracketed languages. The operator uses two charcters and looks like this " ?: ". It's used like this:


//JavaScript

var sDude = new String("Anakin");
var sMessage = new String();

sMessage = (sDude == "Anakin")?"Jedi":"Sith";

alert(sMessage);

//alerts "Jedi"



But On the server VBScript dosen't have anyoperators like that which I find are quite a line saver in other languages. Trianry has been found in other places VBScript has been used like VBA (Visual Basic for Applications), and when it is supported it look like a function/language construct called IIf.

A work around for this that I've found usefull was to define a function for the trinary operation, or inline if, or immeidate if as it's been called. Like so


'VBScript
'RunAt=Server

Function IIf(varTest, varTrue, varFalse)
If varTest Then IIf = varTrue Else IIf = varFalse
End Function




But be wary children, you must declare each parameter or you'll get an error.

I'll try to only post things that I think are hard to find answers and things that I at least have a solid work around for. Otherwise happy coding.

--muja

Classic ASP

· · 🌡️ 49°F

I program in Classic ASP at work, though I'm moving to .NET soon.

Still there are a lot of programmers that program in Classic ASP, and don't have an option to change that could use a resource like I hope this journal posting will become.

I'm going to keep updating this journal everytime I find something wonky with Classic ASP that I've figured out.

Maybe I'll start a profile called William Gates where I can post these things. Ooh, or maybe I'll just start a category called Classic ASP (enknot's kinda slow sometimes kids, you're going to have to forgive him.)

First one's first is the Data Dictionary .Add Bug...yeah.