By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
458,053 Members | 939 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 458,053 IT Pros & Developers. It's quick & easy.

How to make the page?

P: n/a
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.
Aug 9 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
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
"Robert" <Bl*@bla.nl> wrote in message news:dd**********@news.cistron.nl...
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>

Aug 9 '05 #2

P: n/a
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.


*** Sent via Developersdex http://www.developersdex.com ***
Aug 12 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.