Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL Hell

Status
Not open for further replies.

kefi2927

IS-IT--Management
Apr 3, 2003
40
GB
Hi Guys
Can anyone help me with my sql statement?

I have two tables Employees and Centre. I need to show on page LastName, FirstName, CentreName, JobTitle from Employees table and TelNo from Centre table.
TelNo is Tel No of Centre. CentreName is from Employees table and is a foreign key. I have CentreName in Centre table as a primary key. This is what links the two tables. I tried creating the SQL in Access as a query. When i imported it into my asp page this still didn't work.

The SQL statement is:
SQL="SELECT Employees.LastName, Employees.FirstName, Employees.CentreName, Employees.JobTitle, Centre.TelNo FROM Centre INNER JOIN Employees ON Centre.CentreName = Employees.CentreName"

To call the records:
<%
Do Until RS.EOF 'keep going until the end
%>

<tr valign=&quot;top&quot;>
<td class=&quot;dataContent&quot;> <%=RS(&quot;LastName&quot;)%></td>
<td class=&quot;dataContent&quot;> <%=RS(&quot;FirstName&quot;)%></td>
<td class=&quot;dataContent&quot;> <%=RS(&quot;CentreName&quot;)%></td>
<td class=&quot;dataContent&quot;> <%=RS(&quot;JobTitle&quot;)%></td>
<td class=&quot;dataContent&quot;> <%RS(&quot;TelNo&quot;)%></td>
</tr>


<%
RS.MoveNext
Loop
%>

The error message on asp page is:
Wrong number of arguments or invalid property assignment

/intranet_project/cafespirit/contacts/user_employee/user_listAll_employee.asp, line 139

Line 139 is:
<td class=&quot;dataContent&quot;> <%RS(&quot;TelNo&quot;)%></td>


Any help would be gratefully recieved.

Cheers.
 
You forgot your equals sign:

Wrong: <td class=&quot;dataContent&quot;> <%RS(&quot;TelNo&quot;)%></td>
Right: <td class=&quot;dataContent&quot;> <%=RS(&quot;TelNo&quot;)%></td>

REBORN
------------------------

Lunchlady Doris:
At last the world is safe. Eh fallout boy?
Ralph:
What's for lunch tommorrow? - NEXT
Chicken necks?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top