recordcount property
-
Hi there code below is working fine at my local server (PC) but when i m uploading this code to live server then recordcount property return -1... any solutions????
dim rsRandom,sqlRandom set rsRandom = Server.CreateObject("ADODB.Recordset") sqlRandom = "Some query" rsRandom.open sqlRandom,conn,3,3 response.write(rsRandom.recordCount)
thanks in advance -
Hi there code below is working fine at my local server (PC) but when i m uploading this code to live server then recordcount property return -1... any solutions????
dim rsRandom,sqlRandom set rsRandom = Server.CreateObject("ADODB.Recordset") sqlRandom = "Some query" rsRandom.open sqlRandom,conn,3,3 response.write(rsRandom.recordCount)
thanks in advanceThat means that the recordset doesn't support random access to the rows but only sequential access. The RecordCount property doesn't work as the recordset doesn't know how many records there are. It's probably because you use a different database driver on the live server.
--- b { font-weight: normal; }
-
That means that the recordset doesn't support random access to the rows but only sequential access. The RecordCount property doesn't work as the recordset doesn't know how many records there are. It's probably because you use a different database driver on the live server.
--- b { font-weight: normal; }
-
Hi there code below is working fine at my local server (PC) but when i m uploading this code to live server then recordcount property return -1... any solutions????
dim rsRandom,sqlRandom set rsRandom = Server.CreateObject("ADODB.Recordset") sqlRandom = "Some query" rsRandom.open sqlRandom,conn,3,3 response.write(rsRandom.recordCount)
thanks in advance -
Thanks Guffa i got solution
Function RecCount(rsdef) if rsdef.eof then RecCount = 0 else intRows = rsdef.GetRows rsdef.MoveFirst RecCount = UBound(intRows,2) + 1 end if End Function
bye for nowSo you only want to count the records? Then you shouldn't even fetch all the records, but count them in the database query and only return the number of records. Example:
strSQL = "select count(*) from Users"
objRS = objConnection.Execute(strSQL)
lngCount = objRS(0)
objRS.Close()
Set objRS = Nothing--- b { font-weight: normal; }