Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx_beginners thread: I need a loop that will create a table for each year in my database


Message #1 by "e" <ebyrne1@s...> on Thu, 25 Jul 2002 14:48:14
Hi im having a little problem at the moment, I need to create a table for 
each year in my database at the moment i have managed to create a table 
wth all the years listed what i need looks a little like this:
Year
JobDesc/Category/Director/HOD
JobDesc/Category/Director/HOD
JobDesc/Category/Director/HOD
(had three jobs that year)

Year
JobDesc/Category/Director/HOD
(had one job that year)

Year
JobDesc/Category/Director/HOD
JobDesc/Category/Director/HOD
(had two jobs that year)

etc for each year
Here is my code so far 
***************************************************************************
<%	
	Option Explicit 
	Dim strConnect 
	strConnect = "dsn=w1mail-showreel;uid=emma;pwd=emma;" 
	Public SearchType
%> 
<!-- METADATA TYPE="typelib" 
FILE="c:\Program Files\Common Files\System\ado\msado15.dll" --> 
<HTML> 
<HEAD> 
<TITLE>Using the find method to find a Directors Films</TITLE> 
</HEAD> 
<BODY>
<!-- #include file="order.asp" -->
<%
Dim objCommand, objRS, strSearch, strOrder
Set objCommand = Server.CreateObject("ADODB.Command") 
objCommand.ActiveConnection = strConnect

objCommand.CommandText = "SELECT * " & _
" FROM Freelance INNER JOIN Freelance2 ON Freelance.ContactID = 
Freelance2.ContactID " & _
				"WHERE (([Freelance2].[ContactID]=358)) " 
& _
				"ORDER BY Year DESC"

objCommand.CommandType = adCmdText
	Set objRS = objCommand.Execute
 	Set objCommand = Nothing

If Not objRS.EOF Then
Response.Write "<TABLE BORDER = 
1><TR><TD><B>Year</B></TD><TD><B>Production</B></TD><TD><B>Job 
Desc</B></TD><TD><B>Category</B></TD><TD><B>Director</B></TD><TD>&
lt;B>HOD</B>
</TD></TR>"
While Not objRS.EOF
Response.Write "<TR><TD>" & objRS("Year") & "</TD>" & _
		       "<TD>" & objRS("Production") & "</TD>" & _
			   "<TD>" & objRS("JobDesc") & "</TD>" & _
			   "<TD>" & objRS("Category") & "</TD>" & _
			   "<TD>" & objRS("Director") & "</TD>" & _
			   "<TD>" & objRS("HOD") & "</TD></TR>"
objRS.Movenext
Wend
Response.Write "<TABLE>"
End If
		   
objRS.Close
Set objRS = Nothing
%>
</BODY>
</HTML>
***************************************************************************

Thanks for your help

Emma

  Return to Index