Ask a Question related to ASP Database, Design and Development.
-
Sérgio Almeida #1
recordset.recordcount return allways -1 on select statements
Greetings
On my ASP application I want to retrieve the number
(Recordset.recordCount property) of records affected by a select
statement, but I keep getting -1. Even with an example of W3Schools
(avaiable at [url]http://www.w3schools.com/ado/prop_rs_recordcount.asp[/url]) I get
-1 and not the records affected.
Here is some code (from the w3's example).
<%
set conn=Server.CreateObject("ADODB.Connection")
conn.Provider="Microsoft.Jet.OLEDB.4.0"
conn.Open(Server.Mappath("northwind.mdb"))
set rs=Server.CreateObject("ADODB.recordset")
sql="SELECT * FROM Customers"
rs.Open sql,conn
if rs.Supports(adApproxPosition)=true then
i=rs.RecordCount
response.write("The number of records is: " & i)
end if
rs.Close
conn.Close
%>
What seems to be the problem?
Thanks in advance.
Sérgio
Sérgio Almeida Guest
-
CFIF return RecordCount EQ 0
Hi - need to check if there is a record in a MySQL database. If there is display it if there not show a default Address. Here's what I have. It... -
Best way for implementing mutliple select statements
What's the most efficient method for using multiple select statements from different tables? Open db connection once or open connection for each... -
Newbie: batch statements and return codes.
Hi all, I'm trying to work out how I am going to develope some procs and functions within DB2. Usually what I do when playing with code and testing... -
Need a little help on RecordCount recordset function
I am testing a basic function to access a db from the web and step through a set of client email addresses and send each one an email. I have a... -
Using IF and IsNull statements in SELECT
You would do something like this... select CustomerLastName + isnull(', '+CustomerFirstName,'') from tb -- -oj RAC v2.2 & QALite!... -
Jeff Clark #2
Re: recordset.recordcount return allways -1 on select statements
popular question. Your cursor is wrong. Search google - that question is
everywhere
"Sérgio Almeida" <sgalmeidaNOSPAM@bragatelNOSPAM.pt> wrote in message
news:OgpRtOnmDHA.2772@TK2MSFTNGP10.phx.gbl...> Greetings
>
> On my ASP application I want to retrieve the number
> (Recordset.recordCount property) of records affected by a select
> statement, but I keep getting -1. Even with an example of W3Schools
> (avaiable at [url]http://www.w3schools.com/ado/prop_rs_recordcount.asp[/url]) I get
> -1 and not the records affected.
> Here is some code (from the w3's example).
>
> <%
> set conn=Server.CreateObject("ADODB.Connection")
> conn.Provider="Microsoft.Jet.OLEDB.4.0"
> conn.Open(Server.Mappath("northwind.mdb"))
> set rs=Server.CreateObject("ADODB.recordset")
> sql="SELECT * FROM Customers"
> rs.Open sql,conn
>
> if rs.Supports(adApproxPosition)=true then
> i=rs.RecordCount
> response.write("The number of records is: " & i)
> end if
> rs.Close
> conn.Close
> %>
>
> What seems to be the problem?
> Thanks in advance.
>
> Sérgio
>
Jeff Clark Guest
-
Aaron Bertrand [MVP] #3
Re: recordset.recordcount return allways -1 on select statements
> (Recordset.recordCount property) of records affected by a select
[url]http://www.aspfaq.com/2193[/url]> statement, but I keep getting -1.
Aaron Bertrand [MVP] Guest



Reply With Quote

