Get ready for BLACK FRIDAY shopping starting in

Forums

ASP

This topic is locked

recordcount works one way but not another

Posted 12 Feb 2004 02:02:45
1
has voted
12 Feb 2004 02:02:45 Touti P posted:
Hi there,

I tried one way of getting the record count and it worked but how come the other way doesn't? Please see below:

The code that works:

Dim rsEventID
Set rsEventID = Server.CreateObject("ADODB.Recordset"
rsEventID.ActiveConnection = MM_DataDictionary_STRING
rsEventID.Source = "SELECT * FROM tblEvents WHERE tblEvents.fkEventID =" & rsEvents("EventID" & ";"
rsEventID.CursorType = 1
rsEventID.LockType = 2
rsEventID.CursorLocation = 3
rsEventID.Open()
strSQL_numRows = 0

Response.Write(rsEventID.recordcount)


The code that DOES NOT work:

Dim rsEventID, sSql2, dataConn2
Set dataConn2 = Server.CreateObject("ADODB.Connection"
dataConn2.Open MM_DataDictionary_STRING, adOpenKeyset, adLockPessimistic, adUseClient
sSql2 = "sp_GetEventID " & rsEvents("EventID"
Set rsEventID = dataConn.Execute(sSql2)

Response.Write(rsEventID.recordcount)

---------------------------------

Am I missing something here?

Thanks!

Replies

Replied 12 Feb 2004 11:12:26
12 Feb 2004 11:12:26 Lee Diggins replied:
Hi ele

Me thinks this is to do with the respective objects and their properties. The recordset object has a recordcount property, the connection object doesn't.

Digga

Sharing Knowledge Saves Valuable Time!!!
Replied 12 Feb 2004 20:38:10
12 Feb 2004 20:38:10 Touti P replied:
Duh! Thanks Digga!

Reply to this topic