Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old April 28th, 2015, 11:41 AM
Authorized User
Points: 146, Level: 2
Points: 146, Level: 2 Points: 146, Level: 2 Points: 146, Level: 2
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2006
Location: , , .
Posts: 31
Thanks: 1
Thanked 0 Times in 0 Posts
Default Dynamic Dropdown with a twist

Hello all. I am not really a programmer, just a graphic artist that knew html and is now suddenly web designing when the programmer left. So, please help and forgive poor wording.

I have an employee fired/quit form that collects all the pertinent information, inserts it into a database (EMPLOYEE) and emails the appropriate people. Works like a charm.

I also have a employee directory (EMPDIR) that shows the person's name, IMAGE, department, hire and birth date. Also, works like a charm.

Now, TPTB want me to have the fired person's IMAGE appear on the notice that is emailed out when the Fired/Quit form is filled out. The problem comes in that the Directory and the Quit Form are on two different databases. I want to populate a dropdown list with the image names from the database 'EMPDIR' (Employee Directory) on the Quit Form that is on the database 'EMPLOYEE'. This is what I have so far. It shows the dropdown place holder, but it is not populated and the form goes no further. There are no error codes, so I know I'm close, just not quite there yet.

I have this on the page where I want my dropdown to show up.

<select size="1" name="IMAGE">
<% conn2.open "SERVER=XXX;DATABASE=EMPDIR;UID=YYY;PWD=ZZZ;"
Set rs1 = Server.CreateObject("adodb.recordset")
cmdTemp.CommandText = "SELECT distinct IMAGE FROM directory"
rs1.Open cmdTemp, , AdOpenStatic
while not rs1.eof
%>
<option value="<%=rs1("IMAGE")%>"><%=rs1("IMAGE")%></option>
<%
rs1.movenext
wend
rs1.close
%>
</select>

I hope that's enough code for you, if not, please let me know.

Can anyone help me figure this out? Am I even close?

Thanks in advance.
Jackie
Reply With Quote
  #2 (permalink)  
Old April 29th, 2015, 02:11 AM
Friend of Wrox
Points: 6,664, Level: 34
Points: 6,664, Level: 34 Points: 6,664, Level: 34 Points: 6,664, Level: 34
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2004
Location: Sydney, NSW, Australia.
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
Send a message via AIM to mat41
Default

I can see no issues with your code. Looks like your query does not return any results, I have added some code which will tell you this. Also some oher best practice changes:
Code:
<% conn2.open "SERVER=XXX;DATABASE=EMPDIR;UID=YYY;PWD=ZZZ;" 
   Set rs1 = Server.CreateObject("adodb.recordset")
   cmdTemp.CommandText = "SELECT distinct IMAGE FROM directory" 
   rs1.Open cmdTemp, , AdOpenStatic 
   if not rs1.eof then 
      response.write "<select  name='IMAGE' id='IMAGE'><option value=''>---Select an Image---</option>"
      do until rs1.eof  %>
         <option value="<%=rs1("IMAGE")%>"><%=rs1("IMAGE")%></option>
<%       rs1.movenext
      loop
	  response.write "</select>" 
      rs1.close
	  set rs1 = nothing
   else
      response.write "There are no image results in the directory table"
   end if %>
__________________
Wind is your friend
Matt
Reply With Quote
  #3 (permalink)  
Old April 29th, 2015, 10:37 AM
Authorized User
Points: 146, Level: 2
Points: 146, Level: 2 Points: 146, Level: 2 Points: 146, Level: 2
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2006
Location: , , .
Posts: 31
Thanks: 1
Thanked 0 Times in 0 Posts
Smile

Thank you!!! With a little connection string finagling, it worked like a charm! The first time through it told me I wasn't connecting to the database correctly. Once I got the connection string entered properly the list shows up just like I needed it to.

Thanks!!
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Dynamic linked dropdown in MPP ramkris84 ASP.NET 2.0 Professional 1 December 9th, 2009 05:40 PM
Dynamic Dropdown bullsb Classic ASP Professional 4 March 9th, 2007 07:42 AM
Javascript Dynamic dropdown Menu itHighway Javascript How-To 0 July 24th, 2005 10:53 PM
dynamic dropdown boxes fmh002 Classic ASP Basics 1 June 26th, 2003 08:35 PM



All times are GMT -4. The time now is 06:33 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.