get no of records returned by query in jscript function

48 Views Asked by At

How I can get no of records returned by my query executed with in j script function? I am trying it as following but not getting where I am doing wrong.

function getExecutableSteps() 
{

    var pad ="C:\\Automation\\Workspace\\Input\\Automation.accdb";
    var cn = new ActiveXObject("ADODB.Connection");
    var strConn = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + pad;
    cn.Open(strConn);
    var cm = new ActiveXObject("ADODB.Command");
    cm.ActiveConnection = cn;
    cm.CommandText = "SELECT * FROM TestSteps where TestStepNo='TSU1_TC1_TST1'";
    var rs = cm.Execute(); 
    var TotalnoofRecords = rs.row.count;
    Log.Message(TotalnoofRecords)
}
1

There are 1 best solutions below

0
Ekkehard.Horner On

According to the Docs, the Recordset object has no row property. Read about the (availability of the) Recordcount property to see why a test of .EOF is the way to go.