View Single Post
  #9 (permalink)  
Old January 14th, 2009, 06:05 PM
dalezjc dalezjc is offline
Authorized User
Points: 287, Level: 5
Points: 287, Level: 5 Points: 287, Level: 5 Points: 287, Level: 5
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Jun 2006
Location: Colorado Springs, CO
Posts: 60
Thanks: 1
Thanked 0 Times in 0 Posts

Originally Posted by Old Pedant View Post
(1) The line set rsqdb = server.CreateObject("ADODB.Recordset")
is a waste of code. Because you will later do
set rsqdb = conn.Execute( SQL )
which will WIPE OUT the prior reference to the created recordset. So the one created via createObject will just have to be garbage collected without ever having been used.

(2) By assigning the SQL string to a variable, first, you are able to do a DEBUG output of the SQL. Thus you can easily go test that same SQL in some DB tool (e.g, Query Analyzer).

(3) I added a semicolon after the "use msdb". Yes, I know. It shouldn't be necessary. SHOULDN'T and ISN'T are nearly synonyms. Nearly.

(4) I added an ELSE to the CASE WHEN. Just a bit of paranoia on my part. But "a little paranoia is healthy for programmers and their programs."

(5) I added a positive check for the recordset EOF along with a message indicating it happened. More paranoia.

None of my changes are necessary or even important. Just things that I've found myself doing in my old age as part of my ongoing feeling that computers are out to get me.
Your code generates this error:

Microsoft VBScript compilation error '800a0401'
Expected end of statement
/test3.asp, line 22 & " order by JobStatus ")------------------------^
Reply With Quote