Print Page | Close Window

Is there a better way to do it?

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Classic ASP Discussion
Forum Description: Discussion on Active Server Pages (Classic ASP).
URL: https://forums.webwiz.net/forum_posts.asp?TID=10852
Printed Date: 31 March 2026 at 1:17pm
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: Is there a better way to do it?
Posted By: zaboss
Subject: Is there a better way to do it?
Date Posted: 13 June 2004 at 12:43pm
I have 2 tables which share a common field. In a view, i must show the fields from the first table and 1 field from the second table, At this moment, I create two recordsets:

Set RS1 = MyConn.Execute ("Select * FROM tblDoctori where UserName="& Session("UserName") &"")
Set RS2 = MyConn.Execute ("Select strLocalitate, strLM FROM tblHospitals where strLM = "& RS1("strLM") &"")
...
' then display it.

My question is, is there a better way to do it?
My impression is that for every item in the first recordset, there is a new trip to db which might be very resource consumming.

PS If this is wrong, the solution has to work for MS SQL, mySQL and Access in the same time.

-------------
Cristian Banu
http://www.soft4web.ro - Soft 4 web



Replies:
Posted By: Semikolon
Date Posted: 13 June 2004 at 2:22pm
Try
SELECT tblDoctori.*, tblHospitals.strLocalitate, tblHospitals.strLM
  FROM tblDoctori, tblHospitals
 WHERE tblDoctori.UserName = '" & Session("UserName") & "'
   AND tblHospitals = tblDoctori.strLM

Havn't tried it, so not sure if it works though



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net