ASP Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreASP Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here
  #1  
Old October 3rd, 2003, 12:07 PM
blodefood blodefood is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Location: Canada
Posts: 37 blodefood User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 h 36 m 15 sec
Reputation Power: 5
Question display db records from multiple tables problem

I am trying to set up a catalogue of job descriptions for the company. I have a database with 21 tables. There is the MAIN table with the job description name and general duties. (2 fields plus one for Primary Duties). Then for the primary duties there are 20 tables, each with a primary duty title and a description of that duty. (2 fields with ID linked to Primary Duties in MAIN). This was to allow for up to 20 primary duties per job description. There are two sample records in this database.

I have an ASP page with an HTML table to display the records, but it is not picking up the primary duties for the right position and repeats blank table rows until there are 20 some rows

At the moment I am trying to display all the records, but eventually, I would like to set up a separate page with clickable links to display selected records, i.e. "click here to view Receptionist job description."

This is the code I have thus far. Can anyone help?


<%
if request.querystring("sort")<>"" then
sort=request.querystring("sort")
else
sort="JobDescName"
end if

set conn=Server.CreateObject("ADODB.Connection")
conn.Provider="Microsoft.Jet.OLEDB.4.0"
conn.Open(Server.Mappath("jobdesc.mdb"))
set rs=Server.CreateObject("ADODB.recordset")
sql="SELECT * FROM jobdescmain,Prim1,Prim2 ...etc..."
rs.Open sql,conn

do until rs.EOF
for each x in rs.Fields%>

<table width="700" border="1" cellspacing="4" cellpadding="4" bordercolor="#007A62">
<tr>
<td width="200" valign="top" bgcolor="#F5DE92"><font size="2" face="Verdana, Arial, Helvetica,

sans-serif"><b><%response.write rs.Fields("JobDescName")%></b><br><br>
<hr width="195" align="center" color="#CC6319"><b>
General Duties:</b><br>
<br>
<%response.write rs.Fields("GenDuties")%>
</font></td>
<td width="500" valign="top" bgcolor="#F8F5D4"><b><font size="2" face="Verdana, Arial,

Helvetica, sans-serif">Primary
Duties:<br></b>
<br><%response.write rs.Fields("PrimeDuties")%><br>

</font></td>
</tr>
</table>


<%
next
rs.MoveNext
loop
rs.close
conn.close
%>


Reply With Quote
  #2  
Old October 3rd, 2003, 12:25 PM
don_sparko's Avatar
don_sparko don_sparko is offline
Digitally Challenged
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2003
Posts: 280 don_sparko User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 54 m 14 sec
Reputation Power: 6
i'm guessing its a problem with your query. could you post it?
__________________
My brain cells are like a storm trooper's armor: useless

Reply With Quote
  #3  
Old October 3rd, 2003, 12:36 PM
blodefood blodefood is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Location: Canada
Posts: 37 blodefood User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 h 36 m 15 sec
Reputation Power: 5
I am unclear what you mean by "post."

Reply With Quote
  #4  
Old October 3rd, 2003, 01:11 PM
don_sparko's Avatar
don_sparko don_sparko is offline
Digitally Challenged
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2003
Posts: 280 don_sparko User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 54 m 14 sec
Reputation Power: 6
show us the code. in stead of giving us
sql="SELECT * FROM jobdescmain,Prim1,Prim2 ...etc..."
give us the whole querystatement. post: put it on the forum so we can see it.

Reply With Quote
  #5  
Old October 3rd, 2003, 04:02 PM
blodefood blodefood is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Location: Canada
Posts: 37 blodefood User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 h 36 m 15 sec
Reputation Power: 5
Sorry for taking so long, the whole SQL statement is supposed to look like this:

sql="SELECT * FROM jobdescmain,Prim1,Prim2,Prim3,Prim4,Prim5,Prim6,Prim7,Prim8,Prim9,Prim10,Prim11,Prim12,Prim13,Prim14 ,Prim15,Prim16,Prim17,Prim18,Prim19,Prim20"

Though, I get an error if I go past Prim5.


Reply With Quote
  #6  
Old October 6th, 2003, 08:16 AM
don_sparko's Avatar
don_sparko don_sparko is offline
Digitally Challenged
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2003
Posts: 280 don_sparko User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 54 m 14 sec
Reputation Power: 6
ok, are you selecting a bunch of stuff from like 20 different tables? because if you aren't, then your query is messed up. maybe it should look more like
Code:
select * from table name

and your loop, well maybe you want to try something like this
Code:
<%while not rs.EOF
for x = 0 to rs.Fields.Count - 1
response.write (rs(x)) & "<br>"
next
rs.MoveNext
wend%>

if this isn't it, could you tell me what you are trying to do?

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreASP Programming > display db records from multiple tables problem


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway