How to make the page?

R

Robert

Hello,


I'm trying to collect some data from one page, which have to be mixed up
neatly. This is the aim:



I collect the category names from a table in the database (tblCategorie).
The names are put neatly in a column. Then each category needs a list of
groups that have been entered. The groups are in the table 'tblGroepen'.

That is what I have got so far, but I don't know how combine it and make it
work.



Code:



<!-- #include file="inc/db_start.asp" -->
<!-- #include file="inc/Functies.asp" -->
<html>
<head>
<title></title>
<link href="Style/Default.css" type="text/css" rel="stylesheet">
</head>
<%
if Session("Pro_ID") = "" then
%> <html>
<head>
<title>Inloggen</title>
</head>
<body><center>
<font color="#FF0000">Je bent niet ingelogt!</font>
<br><br><br><br>
<%Call ShowLoginForm%>

</center>
</body>
</html>
<%
response.end
end if
%>
<html>
<head>
<title></title>
<link href="Style/Default.css" type="text/css" rel="stylesheet">
</head>
<body topmargin="10" leftmargin="10" rightmargin="10" bottommargin="10">
<table cellspacing="1" cellpadding="0">
<%
set rst = cnn.execute("SELECT * FROM tblCategorie")
do until rst.eof
%>
<tr>
<td bgcolor="#35559F" height="20">
<%=rst("CatNaam")%>
</td>
</tr>
<tr>
<td>
Groepen hier!
</td>
<tr>
<%rst.movenext
loop
rst.close
set rst = nothing
%>
</table>
<table cellspacing="1" cellpadding="0">
<% set rst = cnn.execute("SELECT * FROM tblGroepen")
do until rst.eof%>
<tr>
<td>
<%=rst("GrpNaam")%>
</td>
</tr>
<%rst.movenext
loop
rst.close
set rst = nothing%>
</table>
</body>
</html>
<!-- #include file="inc/db_end.asp" -->



Can anyone help me with this???



Regards



Robert.
 
R

Ray Costanzo [MVP]

Combine it how? In one table? Are these two totally unrelated chunks of
data? You could try something like:

<%

Dim rsCat, rsGroup
Set rsCat = cnn.execute("SELECT CatNaam FROM tblCategorie")
Set rsGroup = cnn.Execute("SELECT GrpNaam FROM tblGroepen")

%>

<table border="1">
<tr>
<% Do %>
<td>
<%
If Not rsCat.EOF Then
Response.Write rsCat.Fields.Item("CatNaam").Value
Else
Response.Write "&nbsp;"
End If
%>
</td>
<td>
<%
If Not rsGroup.EOF Then
Response.Write rsGroup.Fields.Item("GrpNaam").Value
Else
Response.Write "&nbsp;"
End If
%>
</td>
</tr>
<%
On Error Resume Next
rsCat.MoveNext
rsGroup.MoveNext
On Error Goto 0

If rsCat.EOF And rsGroup.EOF Then Exit Do
Loop
%>
</table>


http://www.aspfaq.com/show.asp?id=2096

Ray at work
 
B

Bullschmidt

Perhaps have tables something like this:

tblCategorie:
CategorieID
CategorieName

tblGroepen:
GroepenID
CategorieID
GroepenName

And for a SQL string joinging the two tables:

strSQL = "SELECT tblCategorie.CategorieID, CategorieName, GroepenID,
GroepenName FROM tblCategorie LEFT JOIN tblGroepen ON
tblCategorie.CategorieID = tblGroepen.CategorieID ORDER BY
CategorieName, GroepenName"

Best regards,
J. Paul Schmidt, Freelance ASP Web Developer
http://www.Bullschmidt.com
ASP Design Tips, ASP Web Database Demo, Free ASP Bar Chart Tool...


<<
I collect the category names from a table in the database
(tblCategorie).
The names are put neatly in a column. Then each category needs a list of
groups that have been entered. The groups are in the table 'tblGroepen'.

That is what I have got so far, but I don't know how combine it and make
it
work.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,228
Members
46,818
Latest member
SapanaCarpetStudio

Latest Threads

Top