function ExecuteQueries()
{
DP = "SQLOLEDB";
DS = "MySQLServer";
DB = "NORTHWIND";
adOpenForwardOnly = 0;
adLockReadOnly = 1;
adCmdText = 1;
try
{
var objRs = new ActiveXObject("ADODB.Recordset");
}
catch (e)
{
alert("ADODB namespace not found.");
exit(0);
}
strConn = "Provider=" +DP+
";Initial Catalog=" +DB+
";Data Source=" +DS+
";Integrated Security=SSPI;"
strComm = "SELECT ProductID,ProductName,UnitPrice "+
"FROM Products " +
"WHERE CategoryID = 7" // select Produce
objRs.open(strComm,
strConn,
adOpenForwardOnly,
adLockReadOnly,
adCmdText);
objRs.MoveFirst();
while (objRs.EOF != true)
{
alert(objRs("ProductID")+"\t"
+objRs("ProductName")+"\t"
+objRs("UnitPrice"));
objRs.MoveNext();
}
objRs.Close
objRs = null;
}
function alert(str)
{
WScript.Echo(str);
}