[thelist] [offlist] Re: [***list] ASP, SQL, Recordsets, Best Practices

Michele Foster michele at wordpro.on.ca
Thu Mar 1 14:52:03 CST 2001


LMAO

Ok.. I have to reply to ya off list ....

First I wrote the email to you directly, then thought, naw I should ask the
group instead of bugging you... hehehehe

Anyway, you answered my second question exactly.. thanks.  Now I remember
WHY I declared all the damn variables first .. but of course it would have
been smart to close the damn recordset instead of waiting to the end of the
page.  Bad habit .. trying to break it.

This is *another* page that was hacked out a year ago between me and the ex,
so, now that I know a lot more than I did then, I'm going back and fixing
stuff up, optimizing the code, and re-learning everything.

Learning, learning.  :)

Michele

P.S.  Related onlist stuff replied onlist. :)


----- Original Message -----
From: "Scott Dexter" <sgd at ti3.com>
To: <thelist at lists.evolt.org>
Sent: Thursday, March 01, 2001 3:36 PM
Subject: RE: [thelist] ASP, SQL, Recordsets, Best Practices


> > When querying a unique field in a database, and the answer is
> > either "yes a
> > record exists" or "no record exists", is it necessary to
> > still loop through
>
> Rudy, you take this one =)
>
> >
> > Or, is declaring the fields an unnecessary step, IF the field
> > is only being
> > written/used once?
> >
> > i.e.    response.write rs("sizefromdb")
>
> *ONLY* once?
>
> yeah, that would be better, but you're holding the recordset open too
long.
> Inside your loop (I presume the loop in (1) above) when you get the value,
> assign it to a variable, then close the recordset. Basically, you want to
> get the value and get out of the db as fast as you can, so:
>
> <%
>
> Set oRS=oDBCON.Execute ("Select blah blah rudy is tha man")
> if oRS.BOF and oRS.EOF then
> sizefromdb=Empty
> else
> sizefromtb=oRS(0) ' the first column, this is faster than by name
> oRS.Close
> end if
> Set oRS = Nothing
> Set oDBCON = Nothing
>
> ...
>
> %>
>
> make sense?
>
> sgd
>
> ---------------------------------------
> For unsubscribe and other options, including
> the Tip Harvester and archive of TheList go to:
> http://lists.evolt.org Workers of the Web, evolt !
>





More information about the thelist mailing list