var conn = new ActiveXObject("ADODB.Connection"); //创建数据库连接bai对象
var rs = new ActiveXObject("ADODB.Recordset"); //创建数据集对象
try{
var connectionstring = "Driver={mysql ODBC 5.2w Driver};Server=localhost;Database=myDataBase;User=myUsername; Password=myPassword;Option=3;Port=3306";
conn.open(connectionstring); //打开连接
var sql = " select * from tb_col "; //查询语句
rs.open(sql,conn); //打开数据集
while(!rs.eof){ //遍历所有记录
rs.moveNext(); //下一条记录
}
rs.close(); //关闭记录集
conn.close();
//关闭数据库连接
} catch(e){
WScript.Echo(e.message); //异常报告
} finally{
}