Spent whole night failing to count 2 records

D

Didier Chesto

Since I use Dreamweaver 8, all recordsets are opened by rs_cmd.Execute().
The problem is that rs.RecordCount() doesn't work anymore. I found a number
of solutions that I cannot get to work.

Solution 1. I have to use the forward only cursor but I don't know how to
do that. I do know how to do that with the 'old' rs.Open() way but this way
I cannot have the convenience anymore of dragging columns in my code.

Solution 2. So I tried counting the records by iteration in a loop until
EOF. Works. The only thing is I cannot rewind the recordset anymore:
rs.MoveFirst() doesn't work.

Solution 3. I don't want to create a separate recordset to count via SQL
for reasons of database load.

Solution 4. Getrows(). Sounds interesting because you get out of the
database a.s.a.p. and use the data from an array. But there's my other
handicap: I program in ASP Javascript, not VBScript. I cannot find a good
example of using Getrows() in Javascript.

Funny how you can spend all night on something simple like counting records
and still don't get it to work. If anybody can help me out, my thanks would
reach rabies-like levels.
 
S

Scott M.

How about using ASP .NET and ADO.NET instead of Dreamweaver and Classic ADO,
where there is no such thing as a RecordSet?

-Scott
 
D

Didier Chesto

Op Tue, 26 Jan 2010 02:26:47 -0000 schreef Mark Rae [MVP]:
You might get a better by response posting in a Dreamweaver newsgroup /
forum - I don't think I've ever seen a Dreamweaver question in here
before...

Dreamweaver is not the source of the problem. If I would code it manually,
I'd have the same problems. If I may cut it down, this is the problem.

var rs_cmd=Server.CreateObject ("ADODB.Command");
rs_cmd.ActiveConnection = MM_database_STRING;
rs_cmd.CommandText="SOME SQL";
rs_cmd.Prepared = true;
var rs = rsClicks_cmd.Execute();

- rs.RecordCount() doesn't work
- rs.MoveFirst() doesn't work
- create rsCount with some sql with a Count(...) statement is not
preferred, the database shouldn't be stressed just to count records
- rs.GetRows() I don't understand because I only find VBScript examples

So what I did as a workaround meanwhile is to iterate through the records,
count them /and/ put the data in an array I understand (much like GetRows I
assume). It works, but not very elegant.
 
D

Didier Chesto

Op Mon, 25 Jan 2010 21:34:59 -0500 schreef Scott M.:
How about using ASP .NET and ADO.NET instead of Dreamweaver and Classic ADO,

Totally true. I'm in the process of hiring a professional with the latest
skills. Until then I try to cope myself with programming techniques I
learnt in the 80's (I got away with that for too long :-D)
where there is no such thing as a RecordSet?

You mean there's no recordset in Classic ADO?
 
S

Scott M.

Didier Chesto said:
Op Mon, 25 Jan 2010 21:34:59 -0500 schreef Scott M.:


Totally true. I'm in the process of hiring a professional with the latest
skills. Until then I try to cope myself with programming techniques I
learnt in the 80's (I got away with that for too long :-D)


You mean there's no recordset in Classic ADO?

No, the sentence was "How about using ASP .NET and ADO.NET instead of
Dreamweaver and Classic ADO,
where there is no such thing as a RecordSet?" ADO .NET does not have a
Recordset - it's obsolete.

I think you'll find that using COM objects (recordset) in a .NET
application, will actually cause the performance of the application to
degrade. Unless you have a specific reason to be using the recordset, you
shouldn't be using it at all.

-Scott
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,056
Latest member
GlycogenSupporthealth

Latest Threads

Top