Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

rs.Count Error - Doesn't support method 2

Status
Not open for further replies.
May 13, 2008
24
US
Hello,

I open a recordset in a classic ASP page with this code:

Code:
<%
Dim rsLogin__MMColParam
rsLogin__MMColParam = "a"
If (Session("TeachID") <> "") Then 
  rsLogin__MMColParam = Session("TeachID")
End If
%>
<%
Dim rsLogin
Dim rsLogin_numRows

Set rsLogin = Server.CreateObject("ADODB.Recordset")
rsLogin.ActiveConnection = MM_Application_STRING

rsLogin.Source = "SELECT StuID, FullName  FROM qryWebLogin  WHERE TeachID = '" + Replace(rsLogin__MMColParam, "'", "''") + "' AND Passwd = '" + Replace(rsLogin__MMColParam2, "'", "''") + "'"

rsLogin.CursorType = 0
rsLogin.CursorLocation = 2
rsLogin.LockType = 1
rsLogin.Open()

rsLogin_numRows = 0
%>

Later on, I try to dictate the HTML that is produced on the page by using:

Code:
IF rsLogin.Count > 0 THEN

From there I have a block of HTML. Later on in the code I have an "ELSE" which lets the user no there if there is no record found.

When I run the page, I receive the error:

"Object doesn't support this property or method: 'Count'"

Can anyone tell me what I am doing wrong? I have used the rs.count property many times in VBA and I was pretty sure I could use it in ASP VBScript. I am still a fledgling newbie, so I may be mistaken.

Thanks alot in advance for any help.

-JP
 
or you can get the actual count by using this:

record_count = rsLogin.RecordCount
 
Thanks alot! Syntax between ASP and VBScript can give me fits sometimes.

I appreciate all the help guys! If it weren't for these forums, I would know nothing.

-JP
 
Be careful with RecordCount. I think it requires you to specify the right kind of cursor when opening the record set, which means you better know a bit about cursors. If you need a record count, using count(table_id) in a SQL query is probably less complicated at this point. If you just want to know if the record set is empty or not, use EOF.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top