Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Spent whole night failing to count 2 records

Reply
Thread Tools

Spent whole night failing to count 2 records

 
 
Didier Chesto
Guest
Posts: n/a
 
      01-26-2010
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.
--
Everything I do is either illegal, immoral, or fattening.
(W.C. Fields)
 
Reply With Quote
 
 
 
 
Scott M.
Guest
Posts: n/a
 
      01-26-2010
How about using ASP .NET and ADO.NET instead of Dreamweaver and Classic ADO,
where there is no such thing as a RecordSet?

-Scott



"Didier Chesto" <(E-Mail Removed) w> wrote in
message news:1esfesg4a22i3$(E-Mail Removed).. .
> 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.
> --
> Everything I do is either illegal, immoral, or fattening.
> (W.C. Fields)



 
Reply With Quote
 
 
 
 
Didier Chesto
Guest
Posts: n/a
 
      01-26-2010
Op Tue, 26 Jan 2010 02:26:47 -0000 schreef Mark Rae [MVP]:

> "Didier Chesto" <(E-Mail Removed) w> wrote in
> message news:1esfesg4a22i3$(E-Mail Removed).. .
>
>> Since I use Dreamweaver 8

>
> 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.

--
Everything I do is either illegal, immoral, or fattening.
(W.C. Fields)
 
Reply With Quote
 
Didier Chesto
Guest
Posts: n/a
 
      01-26-2010
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 )

> where there is no such thing as a RecordSet?


You mean there's no recordset in Classic ADO?
--
Everything I do is either illegal, immoral, or fattening.
(W.C. Fields)
 
Reply With Quote
 
Scott M.
Guest
Posts: n/a
 
      01-26-2010

"Didier Chesto" <(E-Mail Removed) w> wrote in
message news:1k7adbzm617af$.1w17dw68ot44w$(E-Mail Removed). ..
> 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 )
>
>> where there is no such thing as a RecordSet?

>
> 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


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
The non-night night shot Vance Digital Photography 3 10-13-2010 01:47 AM
Net::SSH::W32Perl->cmd() hangs for whole night lovecreatesbeauty@gmail.c0m Perl Misc 1 11-17-2008 09:54 AM
*WITHOUT* using: ValidateRequest="False" for the whole page (or my whole site).... \A_Michigan_User\ ASP .Net 2 08-21-2006 02:13 PM
Assessment Training Material - The best 5.00 bucks I ever spent. oanW MCSE 2 01-28-2005 05:32 PM
Estimate of hours to be spent on a project Bob ASP .Net 31 07-16-2004 03:01 PM



Advertisments