Compilation error: On Error Goto...Syntax 
Author Message
 Compilation error: On Error Goto...Syntax

Why would I get a compilation error by changing the "On error resume next"
to "On error goto Error100?

'Clarify DataWarehouse Build
Option Explicit

Dim oFSO, oWSH
Dim vSid, vUser, vPassword, vSqlFile, vCommand, vCommandError, vRc
Dim vSqlPlus

'CONSTANTS
vSqlPlus = "plus33"  'Oracle likes to rename EXEs for each software rev

On error resume next
'On error goto Error100
Set oWSH = CreateObject("WScript.Shell")
If Wscript.Arguments.Count > 3 Then
  vSid = Wscript.Arguments.Item(0)
  vUser = Wscript.Arguments.Item(1)
  vPassword = Wscript.Arguments.Item(2)
  vSqlFile = Wscript.Arguments.Item(3)
  vCommand = vSqlPlus & " -s " & vUser & "/" & vPassword

  oWSH.Run vCommand, , True
Else
  oWSH.Popup "Syntax: ClarifyDwBuild.vbs <sid> <user> <password> <SqlFile>"
End If
WScript.quit

Error100:
  vCommandError = "blat " & vSqlFile & " -t " & vMailRecipients & " -s
ERROR_ClarifyDwUpdate"
  'oWSH.Run "DEBUG: " & vCommandError
  WScript.quit



Fri, 30 Mar 2001 03:00:00 GMT  
 Compilation error: On Error Goto...Syntax

Quote:

> Why would I get a compilation error by changing the "On error resume next"
> to "On error goto Error100?

> 'Clarify DataWarehouse Build
> Option Explicit

> Dim oFSO, oWSH
> Dim vSid, vUser, vPassword, vSqlFile, vCommand, vCommandError, vRc
> Dim vSqlPlus

> 'CONSTANTS
> vSqlPlus = "plus33"  'Oracle likes to rename EXEs for each software rev

> On error resume next
> 'On error goto Error100
> Set oWSH = CreateObject("WScript.Shell")
> If Wscript.Arguments.Count > 3 Then
>   vSid = Wscript.Arguments.Item(0)
>   vUser = Wscript.Arguments.Item(1)
>   vPassword = Wscript.Arguments.Item(2)
>   vSqlFile = Wscript.Arguments.Item(3)
>   vCommand = vSqlPlus & " -s " & vUser & "/" & vPassword

>   oWSH.Run vCommand, , True
> Else
>   oWSH.Popup "Syntax: ClarifyDwBuild.vbs <sid> <user> <password> <SqlFile>"
> End If
> WScript.quit

> Error100:
>   vCommandError = "blat " & vSqlFile & " -t " & vMailRecipients & " -s
> ERROR_ClarifyDwUpdate"
>   'oWSH.Run "DEBUG: " & vCommandError
>   WScript.quit

Because Wscript and Cscript do not support the full VBScript complement
of functions/methods/commands.  This is one area that is significantly
truncated.  Only the 'On Error Resume Next' syntax is supported.  It is
necessary to write your own error handling routines, based on the
condition of the Err.Number result provided by Wscript.

Sorry, I'm a novice (who knows the reason, but is insufficantly versed
in constructing the code), so I can't give exact code.  I'm putting my
two cents in because no one else seems to be entering the fray.

Tom Lavedas
-----------
http://www.pressroom.com/~tglbatch/



Sat, 31 Mar 2001 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. on error goto 0 in VBScript

2. On Error GoTo?

3. On Error Goto

4. On Error Goto Label

5. VBScript/ASP - Help with On Error Goto

6. On Error GoTo 0 ???

7. Using On Error Goto

8. OT: BASIC (was Re: On Error GoTo 0 ???)

9. What does - On Error goto 0 - mean?

10. Please help - compilation error with Ghostscript

11. gv-3.5.8 compilation error on AIX

12. VBScript compilation error when moving to production server

 

 
Powered by phpBB® Forum Software