Forum Discussion
joffre
15 years agoRegular Contributor
That is correct in that the code you're currently using, that being the "keys" method on the prompt window, is working.
The reason why your code using the WScript.Shell object to execute is not working is that WScript.Shell replaces the step of opening up the command prompt before you type SQLPLUS.mysqltool -a -b "DROP TABLE blahblahblah"
to call within WScript.Shell. If you can find such a tool, then you can use WScript.Shell.
What I've found for SQLPLUS can be found here
Essentially, what you would do is take the query you have in CriarUsuario9i and save it to a file, say MySQL.sql.
What you would then do, in your function, is call the Run command, passing a commandline that sayssqlplus myuser/mypassword@mydatabasename @MySQL.sql
If the MySQL.SQL has to change from run to run, then you can create the SQL query in code and save it to file before you attempt to execute it.
I'll try and let you know in a few hours.