Can't Get Recordcount Property To Work!!

I'm opening a recordset with a SQL statement and then trying to use the .RecordCount property to count the number of rows in the recordset. For some reason, it is always returning -1. Code:

View Replies


ADVERTISEMENT

Recordcount -1

I'm simply trying to get a number of records returned in a recordset, and
just get a -1. I have looke din a few books and other references, can't
seem to find any answers. Anyone have any idea why I can't get a real
number? For the record, the recordset is not empty. In fact, it has many
records which I can see plainly on the screen. But when I do response.write
rs.recordcount, it just shows -1

View Replies View Related

Recordcount

i tried using a few method from the forum and fail. So anyone can help me out with this, i wanted to count the total number of record in the on of the table Namecard, so tried this code but fail, anyone can help me out? Code:

View Replies View Related

.RecordCount

Our application currently runs on aWindows 2000 Advance server with Oracle 8i and Microsoft IIS 6.0. We are changing servers and will now be running a Windows 2003 server with Oracle 8i and Microsoft IIS 6.0.

The .RecordCount property does not work on the server. It returns a -1. We have not changed any code.

Any idea why this would happen? Are there certain parameters that have to be set to get the .RecordCount to work?

View Replies View Related

RecordCount

I have an ASP page calling a VB COM calling an SQL Server stored procedure. What I would like is to return a recordset to ASP (works fine) and obtain the RecordCount (doesn't work).
The problem seems to be the difference between adOpenForwardOnly and adOpenStatic of the recordset (adOpenForwardOnly is default and doesn't support RecordCount). Unfortunately, I'm unaware of how to specify adOpenStatic for the recordset.
I've seen the "RS.Open SQL, Connection, adOpenStatic, adLockReadOnly" method, but my recordset is populated by a stored procedure "Set objRS = objCmd.Execute" ... any ideas how I can obtain the RecordCount (short of having the stored procedure return a count)?
Also does it matter where I specify the adOpenStatic (ie, in VB COM or ASP)?

View Replies View Related

Getting Recordcount As -1

SET objRds = Server.CreateObject("ADODB.Recordset")
objRds.CursorType = 1
objRds.LockType = 3 'adLockOptimistic
objRds.ActiveConnection = objConn
objRds.open strSql
objRds.Recordcount

when i run the srl in query anaylzer, i get records, more than 1 but record count gives me -1 .

View Replies View Related

Get The Recordcount

I've like to check whether the recordcount equals 0, 1 or greater than 1. I'm still getting to grips with ASP, but hope this isn't too hard. Coming from CF background - have sussed out conditional stuff in ASP, but need to do recordcounts for validation.

View Replies View Related

Recordcount

I have this:

intTotalNumNewsEntries = rsNews.RecordCount

to count total records in rsnews table, how do i change this to count not all the records, but count the records that has a certain field with a value in it? ie:

intTotalNumNewsEntries = rsNews.somedbfield.RecordCount

View Replies View Related

RecordCount

I know for a fact that in my database, I have three records under the users
table. However when I execute this code:

View Replies View Related

ADO RecordCount Doesn't

When I use the following, the RS.recordcount is -1. I also can't do a RS.moveprevious.
What have I overlooked? Code:

View Replies View Related

Recordcount Results

I'm using multiple recordsets on a page, and they are all returning correct results and enough of them. My problem is when I try to access the recordcount property rs.recordcount, they all return a result of -1. This would usually mean that no records are returned. So why is showing my recordsets that are displaying records with recordcounts of -1. I can't seem to figure out.

View Replies View Related

Recordcount Problems

can anyone tell me why this chunk of code returns "-1"

'dbcnx is database connection

sql = "SELECT * FROM articles"
Set rsArticles = dbcnx.Execute(sql)
rsNumRows = rsArticles.RecordCount

Response.Write("Viewing " & rsNumRows & " record(s).")

even though the db has pulled at least 10 records... i cant figure it out... it has broken alot of my code.. and i've been forced to find different means of making the same code work in asp that i could write quickly in php. i'm trying to learn asp now, and i'm just having problems with this..

View Replies View Related

ObjRS.RecordCount

I have:

strSQL = "SELECT * FROM newarchive WHERE Program_Title LIKE '%" & program & "%' ORDER BY ID"

set objRS = objConn.Execute(strSQL)

Response.Write "There are " & objRS.RecordCount & " results."

I get -1 for the count on every search.

View Replies View Related

ADO.RecordSet.RecordCount

I searched the web for this, but couldn't find any reason as to why this was happening to me. I have a database set up with one record in the students table. I just issused a query "SELECT * FROM students" to test my DB. When I try to get the number of records with adoRS.RecordCount, it returns a -1.

Code:

set adoConn = Server.CreateObject("ADODB.Connection")
set adoRS = Server.CreateObject("ADODB.Recordset")

adoConn.Open "DSN=myodbc"
adoRS.ActiveConnection = adoConn
adoRS.Open "select * from students"
response.write(adoRS.RecordCount)

I do have an entry in the students table, so the RecordCount should be 1. BTW, I'm using the latest MyODBC 3.51 driver.

View Replies View Related

RecordCount Error

recCount = rsFaq.RecordCount


Response.Write("Total number of records: " & recCount)

it outputs -1 even though there are 4 records, how come?

View Replies View Related

Displaying Recordcount

i use this code;

Dim aCount
rsArchive.Open "SELECT * FROM qryArchive", db
aCount = rsArchive.RecordCount

but why aCount is still -1? the actual recordcount should be 4?

View Replies View Related

RecordCount With AdOpenStatic = -1

I'm having a hell of a time with this...

From researching multiple websites, specifying the asOpenStatic cursor should return the correct RecordCount.

Here is my code:

sql = "SELECT UserID,UserName,Password,AccessLevelID,LockThreshold,Active FROM tbl_users WHERE UserName = '" & username & "' and Password = '" & password &"' "

set rs_login=Server.CreateObject("ADODB.Recordset")
rs_login.Open sql, conn, adOpenStatic', adLockReadOnly, adCmdTable

if rs_login.RecordCount <> 0 then

Response.Write("Login Successful" & "<br>")
Response.Write("Record Count: " & rs_login.RecordCount)

end if

I know I can use the select count(*) instead, but I've been researching this for quite some time now and I would like to know what's wrong.

View Replies View Related

Recordcount Keeps On Returning

im having returning the recordcount of my recordset. i have already set the cursor to be adOpenStatic but it still returns -1.

View Replies View Related

Recordcount From Command Object

I have a recordset object generated by the command object
as in recordset object=command.execute

now recordset.recordcount gives me -1 !!!!
the actual record count is 7!!!

Any body who can tell em how to change the cursor type of the recordset
which is generated by a command object!!!

View Replies View Related

Recordcount Of Adocon's Recordset

when the recordcount of the recordset of a adocon is -1, how can I write the record count correctly? I once tried:

rs.movelast
response.Write(rs.AbsolutePosition)

it report the following message for the movelast method

Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E24)
Rowset does not support fetching backward.

View Replies View Related

Count = Rs.RecordCount - Returns -1?

I have this code and it keeps spitting out -1 when I know there are 9 records, please help me.

Randomize

DIM cat,random_number(), counter, check,count

cat = Request("category")
Set cnn1 = Server.CreateObject("ADODB.Connection")
openStr = "driver={Microsoft Access Driver (*.mdb)};" & _
"dbq=" & Server.MapPath("database/images.mdb")
cnn1.Open openStr,"",""

sql = "SELECT * FROM gallery WHERE category = '" & cat & "' Order by ID"
Set rs = Server.CreateObject("ADODB.Recordset")
rs.Open sql, cnn1, adOpenDynamic, adLockOptimistic, adCmdText

count = rs.RecordCount

redim random_number(9)

View Replies View Related

If Statement Not Working With Recordcount???

Can someone explain this:
-----------------------------------------
CQuantity = 8
if 4 < cQuantity then (works)
-------------------------------------------

'Get Record Count of This Type of Property
set rsProp1 = server.createobject("adodb.recordset")
rsProp1.pagesize = 1
mysql = "select * from Property where PropTypeID="&cAccomID
rsProp1.open mysql,cn,3,3

response.write(rsProp1.recordcount) >> = 4

if rsProp1.recordcount < cQuantity then (DOES NOT WORK!!!! QUANTITY IS STILL 8)

View Replies View Related

Recordcount Issue On Iis6

My company is in the process of moving servers and I am one of the developers in charge of making sure it runs smoothly. Currently, we are on a Linux server that runs Chilisoft ASP. We are moving to a 2003 Server with IIS6.Several of our scripts use the recordcount property of recordsets.

On the new server, recordcount seems to be shaky. We have managed to get it working on one of our websites fine, but on another site on the same server it does not. Both sites are configured in the same manner. We did have to add "objConn.CursorLocation = adUseClient" before opening each connection, which made it work for the first site, but adding the same line of code on the other site seems to have no effect.

View Replies View Related

Strange Value Returned From Recordcount

why a ADO recordset.recordcount would return a -1? I have confirmed that it has records in it by writing some values to the screen. Why can't I count the number of records returned though?

View Replies View Related

Examples Of Recordcount Object

i am trying to count the records in an access database, and i cant seem to figure out the syntax to count the records and output a response.write with the number.

View Replies View Related

Object Doesn't Support :: MoveNext, EOF And RecordCount

I'm getting errors when trying to access any Recordset properties and methods

"Object Doesn't support Property error" MoveNext
"Object Doesn't support Property error" EOF
"Object Doesn't support Property error" RecordCount

I'm using a DSN and ADO do I have to change to an OLE DB connection?

View Replies View Related

Asp.net Property In Asp

there is a property in asp.net called autopostback, what i want is to set this property
on plain asp to give a combo the ability to postback the selected option.

Is this possible???? i need to set something like that to a dinamic combo, any ideas????

If it can be done in java or vbscript just please tell me, cause i don�t have a clue if is possible or not.

View Replies View Related

Adodbconnection - Property Value

I don't understand why but If I use vbscript the following code works
fine:

....connection string.....
dbConn.Open
msgbox dbConn.Property

but the corresponding code in asp:

...connection string.....
dbConn.Open
response.write dbConn.Property

returns the error "Arguments are of the wrong type, are out of
acceptable range, or are in conflict with one another" In both cases
connection to sql server is ok.

View Replies View Related

Textbox Property

I have a requirement like this.When the textbox gets focus..at this even i want to change the input langauge settings.like arabic.
Currently i have to do it manually by pressing the Alt+Shift key..to toggle between twon langauages

View Replies View Related

Property Procedure

when do u use property procedure for example
PublicProperty CompanyName() AsString
Get
Return strCompany
EndGet
Set(ByVal Value AsString)
strCompany = Value
EndSet
EndProperty

View Replies View Related

Timestamp Property

I've created a form and I want to add a timestamp to it. How do I do this? I'm using dreamweaver by the way.

View Replies View Related

EnableViewState Property

I have a few server controls on my page. Also I have a aspropDownList with AutoPostBack="True". When I select any value from the dropdownlist I want all the controls to be empty when my page reloads.

Can I use the EnableViewState property for this or I have to write specific code to do this? Currently the values which I had enetered in the servier side controls are retained after the postback.

View Replies View Related

Word Property

does anyone know how to change dynamically a property in some word documents?(in vb, javascript or even if you've got a tool or something )

For example:

In my directories I've got docs with a property "version" I want a tool to update each "version" in my files...

View Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved