Click to See Complete Forum and Search --> : Need help w/ ASP pulldown from SQL db


FcVMo8
04-22-2006, 03:18 PM
The solution to this was to use the WHERE and OR clauses in the SQL SELECT statement like so:

WHERE JOB_NAME = 'John Doe' OR JOB_NAME = 'Ann Smith' OR JOB_NAME = 'Ed Jones'

:)



I'm new to both SQL and VB. I have a table with one field JOB_NAME containing 20 records. Out of that field I want to retrieve 6 of the 20 records into a pulldown menu. They are all unique names like so:

Anna Smith
John Doe

I've been unable to get the unique recordsets out of the db via the SQL SELECT statement. Any way to do that with ASP?

Right now the SELECT pulls all of the records out. I only want 6 specific ones. If it can't be specified in the SELECT statement then how can I return only those 6 to the screen, even if all of them are being pulled?

Thanks,
AJ

Terrorke
04-24-2006, 02:32 AM
Try something like this :

<select>
<%
sql = "select values from table where JOB_Name = 'whatever'"
set RsJobs = db.execute(sql)
while not rsJobs.eof
if rsJobs("JOB_NAME") = "Anna Smith" or ... then
response.Write("<option value="&rsJobs("JOB_NAME")&">"&rsJobs("JOB_NAME")&"</option>"
end if
rsJobs.movenext
wend
%>
</select>

That should do it