Forum Discussion
11.21.2420.7
Can you post a screenshot of the code? Just the one you're trying to run is fine.
- randall9 years agoContributor
function DeleteDatabase(srvrInstanceName, scriptPath) { var commandDraft = "sqlcmd -S " + srvrInstanceName + " -i " + scriptPath; var command = """ + commandDraft + """; Log.Message("scriptPath = " + scriptPath); Log.Message("command = " + command); var Return = shell.Run(command, 1, true); Log.Message("Return = " + Return); if (Return != 0) { Log.Error("database deletion failed") } }
- joseph_michaud9 years agoModerator
Are you setting the cursor inside the DeleteDatabase() function? The Run button only works with functions that have no parameters...
- randall9 years agoContributor
Joseph,
I am and I believe I have found the error in my ways. When running a function with parameters I usually comment out the function start line and create a new one without any parameters. Then I explicitly define the parameters inside the function. I obviously forgot to do that this time.
Thanks for helping me to see the forest amongst the trees. :-)
Cheers,
Randall
- Marsha_R9 years agoModerator
In my VBScript scripts, only the Sub section will enable the button. The Functions won't run separately. I wonder if this is a similar issue.
- randall9 years agoContributor
Marsha,
I don't think so. In Jscript there are no subroutines. Everything is a function, even the main. Besides, I've been working on this project since April and have not had this problem until now.
Thanks,
Randall
Related Content
- 2 years ago
- 4 years ago
- 6 years ago
Recent Discussions
- 3 days ago
- 3 days ago
- 6 days ago