Forum Moderators: open
The db from which the rs is queried contains a column called PageName with a text value, like default.asp
I have tried the below code, but it doesn't seem to work:
dim default
default=0
While (Not rs.EOF) and (rs.Fields("PageName").Value = "default.asp")
default = default + 1
rs.MoveNext
Wend
This response.write always returns a zero value.
response.write "Matches: " & default & " "
Can someone tell me where I am going wrong? Am I missing some syntax or something? I am not getting any returned errors and I am very new to ASP so any help would be appreciated.
In case it is relevant, the db is Access 2003 with an ADODB connection. I am using Dreamweaver CS4.
Thank you!
i am familiar with .GetRows and am using it elsewhere, the problem is that the only way I know how to use it is to get the total # of records from the rs, not counts on an individual value. I would like to avoid running multiple queries to the db for each individual value of "PageName" that I need counts for.
is there a way to use GetRows to count specific values from a single rs?
Thanks for your help
Thank you for your help defanjos.
The data is placed in the db by an INSERT statement that had extra spaces in the code... as a result the values had a leading and trailing space. I fixed the INSERT and ran a trim() in access and replaced my values and now it actually counts. The ASP that I am using now for counting is:
dim default
default=0
While Not rsURLIDgr.EOF
if rsURLIDgr.Fields.Item("PageName").Value = "default.asp" then
default = default+1
end if
rsURLIDgr.MoveNext
Wend
Thanks again for your help!