Is there a better way?

M

MD Websunlimited

Larry,

There are performance draw backs to using two recordsets instead of a "join" but as long as you're happy with it and it does not
drag your pages down.
 
T

Thomas A. Rowe

Can you state exactly what the performance hit is, in exact terms?

--

==============================================
Thomas A. Rowe (Microsoft MVP - FrontPage)
WEBMASTER Resources(tm)

FrontPage Resources, WebCircle,
MS KB Quick Links, etc.
==============================================


MD Websunlimited said:
Larry,

There are performance draw backs to using two recordsets instead of a
"join" but as long as you're happy with it and it does not
 
L

Larry Rekow

Ouch. The single response.write is much better than the implied multiple statements being used here.
++++++++++++++++++++++++++++++++++++++++++++
I'll keep that in mind. This is an intranet for a company with a total
of about 100 people, and I very much doubt more than 8 or 10 ppl would
be on it at any given time, so I'm not trying to optimize the site for
speed. I'll give it a try with the JOIN statement as well just to see
if I can pick up any difference. But I think I may stick with the
multiple statements to break things up, because I want an "IF...THEN"
around the "title" field, in case the contact person doesn't have one,
so there is not an unnecessary comma after the person's name, if you
know what I mean.

The page is going live next week and I'll have a few key ppl watch out
for any speed problems.

Thanks,

Larry
- - - - - - - - - - - - - - - - - -
"Forget it, Jake. It's Chinatown."
 
T

Thomas A. Rowe

Larry,

You shouldn't have any performance issue, especially if on a intranet, when
opening two or more recordsets.

There are many times when it is just not to possible to use a Join, such as
in a shopping cart application, where you are display the cart total, while
the user is still shopping for products, so you have a recordset that
displaying the cart total, as well as a recordset displaying products, etc.

I use them frequently in all of my projects.

Examples:

http://www.glassart.biz
http://www.ourcondo.com
--

==============================================
Thomas A. Rowe (Microsoft MVP - FrontPage)
WEBMASTER Resources(tm)

FrontPage Resources, WebCircle,
MS KB Quick Links, etc.
==============================================
 
M

MD Websunlimited

In exact terms -- give me a break this isn't really the forum for that.

In a nut shell you have two recordsets that must be instanuated instead of one. You have two memory buffer areas etc. All of which
require build up and tear down. I would think that this should be obvious.
 
M

MD Websunlimited

I would doubt you'd see any speed problems from doing it Tom's way. The problem is that if you get in the habit of coding in that
manner you may run into issues at some other time or tax the server before its time.

There are a lot of ways to accomplish things that achieve the same results but some are just better than others. Doing statements
like

<% =rs("FirstName") %>
<br>
<% =rs("LastName") %>
<br>
<% =rs("Address1") %>

Is an example of poor programming, IMHO, unless there is an real need.

This is even better than the above but not by much
<%
response.write rs("FirstName") & "<br>"
response.write rs("LastName") & "<br>"
response.write rs("Address1")
%>

And this is the would be proper method IMHO and it is a "Best Practice"
<%
response.write rs("FirstName") & "<br>" & rs("LastName") & "<br>" & rs("Address1")
%>

Remember this is interperted code that is not optimized.
 
T

Thomas A. Rowe

None of the sites that I have developed are experiencing any problems or
performance issues because of this method. Each of us has our own way of
programming and to use one method over another, is a choice we each make
depending on the project. This does not make for poor or bad programming.

Bad or poor programming is programming the crashed the application or the
server.

Using the shortcut Response.Write statement is a well accepted means of
coding, and it is lot faster to write and debug then to use Response.Write
statement.
--

==============================================
Thomas A. Rowe (Microsoft MVP - FrontPage)
WEBMASTER Resources(tm)

FrontPage Resources, WebCircle,
MS KB Quick Links, etc.
==============================================


MD Websunlimited said:
I would doubt you'd see any speed problems from doing it Tom's way. The
problem is that if you get in the habit of coding in that
manner you may run into issues at some other time or tax the server before its time.

There are a lot of ways to accomplish things that achieve the same results
but some are just better than others. Doing statements
 
M

MD Websunlimited

I'm sure your websites are not. Your style of writing ASP code is not one that I would recommend to someone learning ASP. You have
your opinion and I have mine - that is what is meant by IMHO.

See http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnasp/html/asptips.asp see Tip #15

You can have poor programming Thomas that does not crash the program.

We've disagreed on this before and we'll continue to disagee at this time.

--
Mike -- FrontPage MVP '97-'02
http://www.websunlimited.com
Create fast, better scaling link bars with CSS Menu Maker
http://www.websunlimited.com/order/Product/CssMenu/css_menu.htm
FrontPage Add-ins Since '97 2003 / 2002 / 2000 Compatible
 
L

Larry Rekow

Larry,

There are performance draw backs to using two recordsets instead of a "join" but as long as you're happy with it and it does not
drag your pages down.
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mike, I've come across a wrinkle using the JOIN method.

Some of my company table records don't have any contact table records
to join to. That is, there are no recorded entries yet for any
contacts at some companies. When this happens, I get an error opening
the page, saying:

Either BOF or EOF is True, or the current record has been deleted.
Requested operation requires a current record.

I tried putting an IF...Then thing around the loop of contacts, so it
wouldn't try to list the contacts if there weren't any, but it didn't
help.

if i add a dummy contact to the company....that is, if i give the
company table something to JOIN to, then it works fine.

Is this to be expected? And is there a workaround short of creating a
blank contact record?

Thanks,

Larry

- - - - - - - - - - - - - - - - - -
"Forget it, Jake. It's Chinatown."
 
L

Larry Rekow

Larry,

Great!

I basically set the recordset up completely separate, so that I can easily
re-used/copy them to other pages, if needed.

But your way works the same.
++++++++++++++++++++++++++++++++++++++++++++++++++++
Hi Thomas,

I'm coming up on a situation where some of the companies don't have
any corresponding contacts in the contacts table. Therefore, I
imagine that a contacts recordset doesn't get created. I'm trying to
put an IF/Then condition so that the contacts loops doesn't happen if
there are no contacts. Is there a simple way to test if the recordset
exists at all? When i try to say:

IF crs("firstname") > "" Then

or somesuch, the page doesn't run, and i'm guessing that it's because
there is no such field to test since there is no such recordset.

If I let the loop run, it works, and nothing is produced...which is
sorta ok, but i wanted to test if there were any contacts at all
first, so i wouldn't have the legend "Contacts:" sitting there with
nothing after it.

Thanks again,

Larry
- - - - - - - - - - - - - - - - - -
"Forget it, Jake. It's Chinatown."
 
L

Larry Rekow

++++++++++++++++++++++++++++++++++++++++++++++++++++
Hi Thomas,

I'm coming up on a situation where some of the companies don't have
any corresponding contacts in the contacts table. Therefore, I
imagine that a contacts recordset doesn't get created. I'm trying to
put an IF/Then condition so that the contacts loops doesn't happen if
there are no contacts. Is there a simple way to test if the recordset
exists at all?
<snip>
Whoops...i figured it out....i put a "IF NOT crs.EOF...

and that worked....

Larry
- - - - - - - - - - - - - - - - - -
"Forget it, Jake. It's Chinatown."
 
T

Thomas A. Rowe

The trend is toward separating code from HTML, the same as the concept of
using CSS to separate layout from the content, so by using Response.Write
statements, you can not achieve this.

--

==============================================
Thomas A. Rowe (Microsoft MVP - FrontPage)
WEBMASTER Resources(tm)

FrontPage Resources, WebCircle,
MS KB Quick Links, etc.
==============================================


MD Websunlimited said:
I'm sure your websites are not. Your style of writing ASP code is not one
that I would recommend to someone learning ASP. You have
your opinion and I have mine - that is what is meant by IMHO.

See
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnasp/html/asptips.asp
see Tip #15
 
T

Thomas A. Rowe

Great!

--

==============================================
Thomas A. Rowe (Microsoft MVP - FrontPage)
WEBMASTER Resources(tm)

FrontPage Resources, WebCircle,
MS KB Quick Links, etc.
==============================================
 
M

MD Websunlimited

Larry,

Has the database been normalized to third normal form?
What is your referential integrity for the various tables?

Referential integrity is when you have must have at least a one to one relationship between tables. Access, when set up correctly,
will enforce it. See
http://office.microsoft.com/assista...CTT=1&Origin=EC010227011033&QueryID=ET-5oeX53


--
Mike -- FrontPage MVP '97-'02
http://www.websunlimited.com
Create fast, better scaling link bars with CSS Menu Maker
http://www.websunlimited.com/order/Product/CssMenu/css_menu.htm
FrontPage Add-ins Since '97 2003 / 2002 / 2000 Compatible
 
M

MD Websunlimited

I agree with your statement but I'm at a lost as to what it has to do with the topic at hand.

But if you'd like to change the topic....

Moving code behind HTML is great but not possible to accomplish in ASP and it has nothing to do with response.write statements. In
ASP.NET it is a breeze and the recommend methodology -- not to mention the most efficient.

Yes CSS should be used to separate layout from content but to accomplish that you'd have to stop using tables and start using CSS
layout. All I've ever seen you post is to use tables for layout. You can't have it both ways. Doing table-less design is very doable
and is being done by the best web designers out there. Example sites: Amazon.com or ESPN.com.
 
T

Thomas A. Rowe

This applies to this topic.

By using <%=rs("Whatever")%>, I can easily apply fonts tags (or CSS, it I
used it) or with <% If... %>, I can surround complete blocks of HTML code,
that would be fully functional (similar to CSS for layout, which I don't use
or see a need to use), without the ASP code, whereas when using a
Response.Write statement, the HTML code can not stand on it own, nor can you
see the content of a Response.Write statement in FP's Normal view, so you
spend more time trying to layout out pages.

"What Your Time Worth?" <smile>

--

==============================================
Thomas A. Rowe (Microsoft MVP - FrontPage)
WEBMASTER Resources(tm)

FrontPage Resources, WebCircle,
MS KB Quick Links, etc.
==============================================


MD Websunlimited said:
I agree with your statement but I'm at a lost as to what it has to do with the topic at hand.

But if you'd like to change the topic....

Moving code behind HTML is great but not possible to accomplish in ASP and
it has nothing to do with response.write statements. In
ASP.NET it is a breeze and the recommend methodology -- not to mention the most efficient.

Yes CSS should be used to separate layout from content but to accomplish
that you'd have to stop using tables and start using CSS
layout. All I've ever seen you post is to use tables for layout. You can't
have it both ways. Doing table-less design is very doable
 
T

Thomas A. Rowe

My method of use <% ... %> (Interleaved text) is faster then using
Response.Write statements!

See:
http://www.4guysfromrolla.com/webtech/021302-1.shtml

--
==============================================
Thomas A. Rowe (Microsoft MVP - FrontPage)
WEBMASTER Resources(tm)

FrontPage Resources, WebCircle,
MS KB Quick Links, etc.
==============================================


MD Websunlimited said:
I would doubt you'd see any speed problems from doing it Tom's way. The
problem is that if you get in the habit of coding in that
manner you may run into issues at some other time or tax the server before its time.

There are a lot of ways to accomplish things that achieve the same results
but some are just better than others. Doing statements
 
T

Thomas A. Rowe

The MSDN ASP Tips #15 appears targeted towards using ASP under NT4/IIS4

--

==============================================
Thomas A. Rowe (Microsoft MVP - FrontPage)
WEBMASTER Resources(tm)

FrontPage Resources, WebCircle,
MS KB Quick Links, etc.
==============================================


MD Websunlimited said:
I'm sure your websites are not. Your style of writing ASP code is not one
that I would recommend to someone learning ASP. You have
your opinion and I have mine - that is what is meant by IMHO.

See
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnasp/html/asptips.asp
see Tip #15
 
L

Larry Rekow

My method of use <% ... %> (Interleaved text) is faster then using
Response.Write statements!

See:
http://www.4guysfromrolla.com/webtech/021302-1.shtml
++++++++++++++++++++++++++++++++++++++++++++++++++++
While we're on the subject of different methods, I was using this
page:

http://www.asp101.com/samples/viewasp.asp?file=db_search.asp

to get some code to help me create a table with some d/b output. And
he uses this method: <%= rstSearch.Fields("first_name").Value %>
How is that different from your method? Or is it just a different way
of writing the same thing?

thanks,

Larry

- - - - - - - - - - - - - - - - - -
"Forget it, Jake. It's Chinatown."
 
T

Thomas A. Rowe

Just a different way of writing the same thing.

--

==============================================
Thomas A. Rowe (Microsoft MVP - FrontPage)
WEBMASTER Resources(tm)

FrontPage Resources, WebCircle,
MS KB Quick Links, etc.
==============================================
 

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

Top