|
Found in a stored procedure...
Declare @IsClosed bit
SET @IsClosed = (SELECT ISNULL(Closed,0)
FROM TimeRegHeader
WHERE TSID = @TSID)
If @IsClosed Is Null
BEGIN
Select 0
END
else
BEGIN
Select @IsClosed
END
|
|
|
|
|
Well, you really have to be sure about these things!!
|
|
|
|
|
Arnaud Lhopiteau wrote: ISNULL(Closed,0)
belts...
Arnaud Lhopiteau wrote: If @IsClosed Is Null
and braces.
What more do you want?
Panic, Chaos, Destruction.
My work here is done.
|
|
|
|
|
|
Hardly a Coding Horror. An inefficient process to be sure, but not a horror.
* Sensible Function names
* Sensible Method Sizes
* Sensible Variable Declarations
* Clear Intent
-------------------------------
Carrier Bags - 21st Century Tumbleweed.
|
|
|
|
|
' MAIN()
'
' Entry point. No more PPd. & Add. (^800 = 5)
'
'^:MAIN
MAIN:
'^PR^! Retract form in printer.
PRINT CMD("PR");
'^PL66^! Set line count to 66 for this form.
PRINT CMD("PL66");
'^PN^! Normal print mode on.
PRINT CMD("PN")
'^:GET.TERMS
GET.TERMS:
'^?"BOL ENTER TERMS (1 - 4): 1. PREPAID 2. COLLECT 3. 3RD PARTY 4. COD"1"1""%d"800
'A%=VAL(INPUTBOX$("BOL ENTER TERMS (1 - 4): 1. PREPAID 2. COLLECT 3. 3RD PARTY 4.COD",1,"1"))
A%=3
'^OC(^800 < 1)(^GT GET.TERMS)
'^OC(^800 > 4)(^GT GET.TERMS)
IF (A%<1) OR (A%>4) THEN GOTO GET.TERMS
'^H
'
' Goto line 2
'^G2
PRINT CMD("G4");
'
' DATE, ORIGIN, DESTINATION
'
PRINT CMD("C50");CMD("D");STRING$(4," "); K$ ; STRING$(6," "); STRJUST$(FLD(14,0),3,"L"," ")
'GOTO ENDING
'
' Skip a line
'
PRINT
'PRINT
'
' Shippers acct Number
PRINT STRING$(20," "); L$
'
'
PRINT
PRINT
'
PRINT STRING$(2," "); CMD("YL");CMD("7");CMD("YB")
PRINT STRING$(2," "); CMD("YL");CMD("8");CMD("YB")
PRINT STRING$(2," "); CMD("YL");CMD("9");CMD("YB"); STRING$(32," "); CMD("PB"); "HAWB#: ";STRJUST$(FLD(10,0),18, "L", " ");CMD("Pb")
PRINT STRING$(2," "); " "
'
PRINT STRING$(2," "); " ";STRING$(20," "); M$
PRINT STRING$(2," ");STRIP$(FLD(40,0),"C", " ")
'
'
'Skip 4 lines
'
PRINT
PRINT
PRINT
PRINT
'
PRINT STRING$(2," ");CMD("YL");STRIP$(CMD("2"),"C"," ");CMD("YB")
PRINT STRING$(2," ");CMD("YL");STRIP$(CMD("3"),"C"," ");CMD("YB")
PRINT STRING$(2," ");CMD("YL");STRIP$(CMD("4"),"C"," ");CMD("YB")
PRINT STRING$(2," ");CMD("YL");STRIP$(CMD("14"),"C"," ");CMD("YB")
'PRINT STRING$(2," ");CMD("YL");STRIP$(CMD("5"),"C"," ");", ";STRIP$(CMD("6"),"C"," ");" ";STRIP$(CMD("7"),"C"," ");CMD("YB")
PRINT STRING$(2," ");CMD("YL");STRIP$(CMD("5"),"C"," ");CMD("YB")
'PRINT
PRINT STRING$(2," ");CMD("YL");STRJUST$(FLD(10,2),18,"L"," ");CMD("YB"); STRING$(2," "); STRIP$(FLD(8,2),"C"," ")
'PRINT STRING$(2," ");
' PO (13chars) / BOL #
PRINT STRING$(2," ");STRJUST$(FLD(40,0),20,"L"," "); STRING$(1," "); STRJUST$(FLD(9,0), 16, "L"," ");
'PRINT STRING$(2," ");STRJUST$(FLD(9,0),13,"L"," "); STRING$(1," "); STRJUST$(FLD(2,0), 16, "L"," ")
'
|
|
|
|
|
Have you posted this in every forum?
No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced.
This message is made of fully recyclable Zeros and Ones
|
|
|
|
|
English
Let there arise out of you a band of people inviting to all that is good, enjoining what is right, and forbidding what is wrong: They are the ones to attain felicity.
Āli-'Imrān (The Family of Imran), 104.
|
|
|
|
|
looks like a basic dialect from out of the legendary Bill Gates times.
Press F1 for help or google it.
Greetings from Germany
|
|
|
|
|
|
So he found the right forum.
To be honest: tons of old code are running: in banks , factories, (nuclear) plants or goverments agencies. They have often a problems finding the code and a maintainer, like COBOL.
Press F1 for help or google it.
Greetings from Germany
|
|
|
|
|
This is the base code vs generates to check for special keys, on a Smart Device project:
private void Form1_KeyDown(object sender, KeyEventArgs e)
{
if ((e.KeyCode == System.Windows.Forms.Keys.Up))
{
}
if ((e.KeyCode == System.Windows.Forms.Keys.Down))
{
}
if ((e.KeyCode == System.Windows.Forms.Keys.Left))
{
}
if ((e.KeyCode == System.Windows.Forms.Keys.Right))
{
}
if ((e.KeyCode == System.Windows.Forms.Keys.Enter))
{
}
}
A Pocket PC is full of power, so let's check for every possible key.
|
|
|
|
|
I don't see any horror here. What do you want to do if you need to check for those keys?
|
|
|
|
|
If the first if is true, for example, why bother testing all the others which follow? It's dopey code.
Steve
|
|
|
|
|
some else if would be much better indeed, and the switch/case would be even more appropriate for this stuff, but still it doesn't real shock me.
|
|
|
|
|
That many bunch of if s could have been elegantly presented with a decent switch block.
Vasudevan Deepak Kumar
Personal Homepage Tech Gossips
The woods are lovely, dark and deep,
But I have promises to keep,
And miles to go before I sleep,
And miles to go before I sleep!
|
|
|
|
|
It's not a big horror, its just funny to see it on Visual Studio. The correct implementation would be:
private void Form1_KeyDown(object sender, KeyEventArgs e)
{
switch(e.KeyCode)
{
case System.Windows.Forms.Keys.Up:
break;
case System.Windows.Forms.Keys.Down:
break;
case System.Windows.Forms.Keys.Left:
break;
case System.Windows.Forms.Keys.Right:
break;
case System.Windows.Forms.Keys.Enter:
break;
}
}
|
|
|
|
|
it is a horror that this visible code is so poor.
What about the non-visible code. Shame on Microsoft!!!
Press F1 for help or google it.
Greetings from Germany
|
|
|
|
|
Invisible code ?!?? Where ??
|
|
|
|
|
I mean the code we cant look at, like the soruce code of windwos or Office.
Press F1 for help or google it.
Greetings from Germany
|
|
|
|
|
KarstenK wrote: we cant look at, like the soruce code of windwos or Office
But we can feel it and enjoy it with timely patches and service packs.
Vasudevan Deepak Kumar
Personal Homepage Tech Gossips
The woods are lovely, dark and deep,
But I have promises to keep,
And miles to go before I sleep,
And miles to go before I sleep!
|
|
|
|
|
Now I am feeling the difference between Version "6.0" and "6.1 RC" of a wellknown Microsoft product. I feel that they really work hard and encouraged.
Press F1 for help or google it.
Greetings from Germany
|
|
|
|
|
Maybe he doesn't understand the Spanish.
Vita est usquequaque virtus victus ut plenus. Ego non sum semper iustus tamen Ego sum nunquam nefas!
|
|
|
|
|
Ah, but this way there's a nice little hack brewing. Modify the parameters in some ASM code mid-execution, and you can invoke multiple segments of code. That way, there's two operating modes built in - cracker and normal user. Crackers can have super-special zero-bug privileges, while normal users can get walloped with the bug-hammer
Of course, a nice little service running in the background on the target machines can do this automatically. Maybe a clause can be put in which stops modifying the code if certain packets are received. Grumpy, abusive user gets bugs, rich user with lots of contacts gets fewer
|
|
|
|
|
You would delete the auto-generated code anyway wouldn't you?
Actually isn't there a file (or files) that contain such things and you can change them there?
|
|
|
|
|