Solved

Dreamweaver ASP and MSSQL---  multiple query problem

Posted on 2004-09-01
3
408 Views
Last Modified: 2012-06-21
When I run the following query in  the Query Analyzer I get correct values

SELECT dbo.tutee.idratuteeid,dbo.tutee.firstname,dbo.tutee.lastname,dbo.tutee.mi,dbo.tutee.gradelevel,dbo.tutee.room,dbo.tutee.elemteacherid,dbo.elemteacher.elemteacherid,dbo.elemteacher.firstname,dbo.elemteacher.lastname
FROM dbo.tutee, dbo.elemteacher
WHERE dbo.elemteacher.elemteacherid=dbo.tutee.elemteacherid

 AND dbo.tutee.teachercoordid =101


When Dreamweaver's ASP repeated regions behavior codes it like this..

          <td><%=(Recordset1.Fields.Item("idratuteeid").Value)%></td>
          <td><%=(Recordset1.Fields.Item("firstname").Value)%></td>
          <td><%=(Recordset1.Fields.Item("lastname").Value)%></td>
          <td><%=(Recordset1.Fields.Item("mi").Value)%></td>
          <td><%=(Recordset1.Fields.Item("gradelevel").Value)%></td>
          <td><%=(Recordset1.Fields.Item("room").Value)%></td>
          <td><%=(Recordset1.Fields.Item("elemteacherid").Value)%></td>
          <td><%=(Recordset1.Fields.Item("elemteacherid").Value)%></td>
          <td><%=(Recordset1.Fields.Item("firstname").Value)%></td>
          <td><%=(Recordset1.Fields.Item("lastname").Value)%></td>

The firstname and lastname values come from the same table which is BAD!!!
What can I add to the Dreamweaver ASP code  to call from the correct tables.
Since I am a dumb dumb...I tried
          <td><%=(Recordset1.Fields.Item("dbo.elemteacher.lastname").Value)%></td>

and got a an error.

Obviously one of the problems is that the column names in the separate tables are the same...firstname, lastname...
1. Should I have named the differently?
2.  Is there a way for Dreamwever's ASP to differentiate between dbo.elemteacher.lastname and dbo.tutee.lastname

Thanks
0
Comment
Question by:hbojorquezgeek
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 17

Accepted Solution

by:
BillAn1 earned 125 total points
ID: 11954903
you need to give the cols distinct aliases in the SQL , then you can refere to them properly in your ASP by their aliases :

SELECT
          dbo.tutee.idratuteeid AS idratuteeid,
      dbo.tutee.firstname AS tutee_fisttname,
      dbo.tutee.lastname AS tutee_lastname,
      dbo.tutee.mi as tutee_mi,
      dbo.tutee.gradelevel as gradelevel,
      dbo.tutee.room as room,
      dbo.tutee.elemteacherid as tutee_elemteacherid,
      dbo.elemteacher.elemteacherid as teacher_elemteacherid,
      dbo.elemteacher.firstname as teacher_firstname,
      dbo.elemteacher.lastname as teacher_lastname
FROM dbo.tutee, dbo.elemteacher
WHERE dbo.elemteacher.elemteacherid=dbo.tutee.elemteacherid
 AND dbo.tutee.teachercoordid =101
0
 

Author Comment

by:hbojorquezgeek
ID: 11955100
First...if I could I would bear your children!!!
Thank you...I am an obvious beginner at SQL and had no idea that I could do that... I've learned so much from this place about triggers and etc...THANKS!
You so rock.
0
 
LVL 17

Expert Comment

by:BillAn1
ID: 11955189
thanks I'm sure ?!
just don't forget to close out on a Question if you have the answer :-)
0

Featured Post

[Live Webinar] The Cloud Skills Gap

As Cloud technologies come of age, business leaders grapple with the impact it has on their team's skills and the gap associated with the use of a cloud platform.

Join experts from 451 Research and Concerto Cloud Services on July 27th where we will examine fact and fiction.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Your data is at risk. Probably more today that at any other time in history. There are simply more people with more access to the Web with bad intentions.
In this blog post, we’ll look at how ClickHouse performs in a general analytical workload using the star schema benchmark test.
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…

623 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question