ただしドライバがインストールされていなければいけない。
ドライバのダウンロード方法は下記参照。
ドライバのダウンロード方法は下記参照。
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<job> | |
<script> | |
;(function(){ | |
var con = new ActiveXObject('ADODB.Connection') | |
execSQL=function(str){ | |
try{ return con.execute(str) }catch(e){} | |
// conの中身がopen実行前だったり、 | |
// openしてから時間が経って接続が失われている場合は以下へ進む。 | |
// ただし「str」の中身が構文エラーでも下に進むことになる。 | |
// その場合、接続が有効な状態の時は「接続済みです」的なエラーが生じる。 | |
con.open( | |
'Provider=MSDASQL;'+ | |
'Driver={MySQL ODBC 5.1 Driver};'+ | |
'Server=192.168.1.100;'+ | |
'DATABASE=DBNAME;'+ // ケースセンシティブ | |
'UID=username;'+ | |
'PWD=password;' | |
) | |
return arguments.callee(str) | |
} | |
})(); | |
レコード = execSQL("select * from tbl_test where id=123") | |
str = '' | |
for(; !レコード.EOF ;レコード.moveNext()){ | |
str += レコード.Fields('password').value + '\n' | |
} | |
WScript.Echo(str) | |
</script> | |
</job> |
0 件のコメント:
コメントを投稿