平成30/ 2018-12-10 16:39
Windows ローカルPC SQL接続 Wscript

var conn = new ActiveXObject("ADODB.Connection");
//var conn = CreateObject("ADODB.Connection");
//var dns = "DRIVER={MySQL ODBC 3.51 Driver}; SERVER=localhost; DATABASE=Your_Mysql_DB; UID=mysql_username;PASSWORD=mysql_password; OPTION=3";
var dns = "DRIVER={MySQL ODBC 5.1 Driver}; SERVER=secure437m.sakura.ne.jp; DATABASE=school; UID=mysql_username;PASSWORD=school;";

conn.open(dns);

var res = conn.Execute("select * from entry limit 0, 2");

//②SQLの実行結果をデータが無くなるまで表示します
do {

    //フィールド値の表示
    WScript.echo(res("name"));

    //カーソルを次の行へ
    res.MoveNext();

} while(res.Eof==false);

conn.close;
conn = Nothing;


ODBCドライバーインストールしないとダメ。
http://www.happy2-island.com/vbs/cafe02/capter00604.shtml

(参考)
http://network.station.ez-net.jp/client/database/odbc/mysql.asp
http://webcache.googleusercontent.com/search?q=cache:kQmZjO66YMIJ:matome.info/VB6MySQL/+mysql+adodb&cd=6&hl=ja&ct=clnk&gl=jp&source=www.google.co.jp
http://webcache.googleusercontent.com/search?q=cache:CTIZ3lQIyK0J:www.cocoaliz.com/excelVBA/index/40/+wscript+mysql+ADODB.Connection&cd=4&hl=ja&ct=clnk&gl=jp&source=www.google.co.jp