//! ADODB.js usage sample
//! TEST.MBD countains table populaed with some data
//! CREATE TABLE tab1 (data VARCHAR(32), param INTEGER );

AkelPad.Include("ADODB.js");
var conn = ADODB.Connection();
conn.Open("PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source=C:\\TEST.MDB;","","");
var comm = ADODB.Command();
comm.CommandText = "SELECT data, param * FROM tab1 WHERE param = @prm";
comm.ActiveConnection = conn;
comm.NamedParameters = true;
comm.CommandType = ADODB.CommandTypeEnum.adCmdText;
comm.Parameters.Append(comm.CreateParameter("@prm", ADODB.DataTypeEnum.adInteger, ADODB.ParameterDirectionEnum.adParamInput, 4/*sozeof(adInteger)*/, 1));
var res = comm.Execute();
var result = "";
while(res && !res.EOF)
{
   var cnt = res.Fields.Count;
   var i =0;
   while(i<cnt)
   {
      result += " " +res.Fields.Item(parseInt(i)).Name+": " + res.Fields.Item(parseInt(i));
      i++;
   }
   WScript.Echo(result);
   result = "";
   res.MoveNext();
}
if(res) res.Close();
conn.Close();
res = null;
comm = null;
conn = null;