Hello.
I need to get the number of rows from a recordset. I use the "RecordCount" property of the Recordset object, but the number is -1 even though in MS Query Analyzer the number of records is 1.
Here my JavaScript code:
var con = new ActiveXObject("ADODB.Connection"
;
con.Open("Provider=SQLOLEDB;SERVER=dflaptop;UID=sa;PWD=;Trusted_Connection=yes;"
;
var rs = new ActiveXObject("ADODB.Recordset"
;
rs.Open("SELECT name FROM master.dbo.sysdatabases WHERE name = \'PTC\'", con)
var x = rs.RecordCount;
alert(x);
The statement in Query Analyzer is exactly the same - 1 record returned.
Anybody can help me?
I need to get the number of rows from a recordset. I use the "RecordCount" property of the Recordset object, but the number is -1 even though in MS Query Analyzer the number of records is 1.
Here my JavaScript code:
var con = new ActiveXObject("ADODB.Connection"
con.Open("Provider=SQLOLEDB;SERVER=dflaptop;UID=sa;PWD=;Trusted_Connection=yes;"
var rs = new ActiveXObject("ADODB.Recordset"
rs.Open("SELECT name FROM master.dbo.sysdatabases WHERE name = \'PTC\'", con)
var x = rs.RecordCount;
alert(x);
The statement in Query Analyzer is exactly the same - 1 record returned.
Anybody can help me?