SQL displayed in html table

liunx

Guest
Hi all,

can anyone tell me why my code is not working. I have tested it in access nd the query works fine but the results wont display in the table.
Thanx in advance.

objconn.open strconnect
Set objrs = Server.CreateObject("ADODB.RecordSet")
objrs.open "SELECT Office.office_name, Personnel.first_name, Personnel.surname
FROM Office, Personnel
WHERE Office.office_id = Personnel.office"
objconn.open
%>


<table><tr>
<%While objrs.EOF <> true%>
<td><%Response.Write%></td>
<%objrs.MoveNext%></tr>
<%Wend%>
</table><table><tr>
<%While objrs.EOF <> true%>
<td><%Response.Write%></td>
<%objrs.MoveNext%></tr>
<%Wend%>
</table>


You're doing a Response.write but don't have anything in it.

It should prolly look like


<table><tr>
<%While objrs.EOF <> true%>
<td><%Response.Write("office_name")%></td>
<td><%Response.Write("first_name")%></td>
<td><%Response.Write("surname")%></td>
<%objrs.MoveNext%></tr>
<%Wend%>
</table>Right. I have now got it working, by selecting all the information from a query in a database:

objconn.open strconnect
Set objrs = Server.CreateObject("ADODB.RecordSet")
objrs.open "SELECT * FROM Query1", objconn
%>

Search Results

<table><tr>
<%While objrs.EOF <> true%>
<td><%Response.Write objrs("office_name")%></td>
<td><%Response.Write objrs("first_name")%></td>
<td><%Response.Write objrs("surname")%></td>
<td><%Response.Write objrs("extension_id")%></td>
<%objrs.MoveNext%></tr>
<%Wend%>
</table>

However, i have a drop down list box on the html page that calls this one and so i want to only display the list of staff in the office that was selected. I have tried the above sql with the where clause: 'where office_name = request.form("txtField")

but this doesnt seem to work. Any ideas?
 
Back
Top