Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 418
  • Last Modified:

Dreamweaver ASP and MSSQL--- multiple query problem

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
hbojorquezgeek
Asked:
hbojorquezgeek
  • 2
1 Solution
 
BillAn1Commented:
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
 
hbojorquezgeekAuthor Commented:
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
 
BillAn1Commented:
thanks I'm sure ?!
just don't forget to close out on a Question if you have the answer :-)
0

Featured Post

Veeam Task Manager for Hyper-V

Task Manager for Hyper-V provides critical information that allows you to monitor Hyper-V performance by displaying real-time views of CPU and memory at the individual VM-level, so you can quickly identify which VMs are using host resources.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now