Varför kan den inte läsa in objektet ? den visar svaret 1 oavsett vad jag skriver i WHERE satsen, vad gör jag för fel? Ditt recordset innehåller en rad med antalet poster.problem med att räkna poster
Felkod Feltyp:
Körningsfel i Microsoft VBScript (0x800A01A8)
Objekt krävs.: ''
/aspe/rrnytt2/count.asp, line 12
Line 12 börjar med "rsCount.Open Visa
------------------------------------------------------------
<!-- #include file="../adovbs.inc" -->
<!-- #include file="../connect.inc" -->
<% Visa = "SELECT COUNT(*) FROM rrnytt WHERE driver = 'ns' "
'RecSet.Open Visa, Connect, adOpenStatic, adLockOptimistic
rsCount.Open Visa, Connect, adOpenStatic, adLockReadOnly, adCmdTable
'Skapar rs
Set rsCount = Server.CreateObject("ADODB.Recordset")
'här öppnar vi rs med en tabell, static cursor, read only
'rsCount.Open rrnytt, connect, adOpenStatic, adLockReadOnly, adCmdTable
'Skriver hur många poster din_tabell innehåller
Response.Write rsCount.RecordCount
'Stänger
rsCount.Close
Set rsCount = Nothing
%>Sv: problem med att räkna poster
<!-- #include file="../adovbs.inc" -->
<!-- #include file="../connect.inc" -->
<%
Set rsCount = Server.CreateObject("ADODB.Recordset")
Visa = "SELECT COUNT(*) FROM rrnytt WHERE driver = 'ns' "
rsCount.Open Visa, Connect, adOpenStatic, adLockOptimistic
Response.Write rsCount.RecordCount
rsCount.Close
Set rsCount = Nothing
%>Sv: problem med att räkna poster
<code>
<!-- #include file="../adovbs.inc" -->
<!-- #include file="../connect.inc" -->
<%
strSQL = "SELECT COUNT(*) AS Antal FROM rrnytt WHERE driver = 'ns' "
Set rsCount = Server.CreateObject("ADODB.Recordset")
rsCount.Open strSQL, Connect
Response.Write rsCount("Antal")
rsCount.Close
Set rsCount = Nothing
%>
</code>