Ho realizzato un piccolo blog. Il database in access è composto da due tabelle... Blog e commenti. Con il codice in basso visualizzo i blog presenti nel database, poi cliccando su commenti visualizzo i singoli commenti associati al blog. Fin qui tutto bene. Volevo inserire accanto al link commenti l'effettivo numero di commenti esistenti... come si fa? Devo creare un nuovo record set... non ci riesco... mi date una mano? Grazie
<%@LANGUAGE="JAVASCRIPT" CODEPAGE="1252"%>
<%
var RecPagine = Server.CreateObject("ADODB.Recordset");
RecPagine.ActiveConnection = MM_conn_euro_STRING;
RecPagine.Source = "SELECT * FROM Blog ORDER BY Data DESC";
RecPagine.CursorType = 0;
RecPagine.CursorLocation = 2;
RecPagine.LockType = 1;
RecPagine.Open();
var RecPagine_numRows = 0;
%>
<%
var Repeat1__numRows = -1;
var Repeat1__index = 0;
RecPagine_numRows += Repeat1__numRows;
%>
<%
// *** Recordset Stats, Move To Record, and Go To Record: declare stats variables
// set the record count
var RecPagine_total = RecPagine.RecordCount;
// set the number of rows displayed on this page
if (RecPagine_numRows < 0) { // if repeat region set to all records
RecPagine_numRows = RecPagine_total;
} else if (RecPagine_numRows == 0) { // if no repeat regions
RecPagine_numRows = 1;
}
// set the first and last displayed record
var RecPagine_first = 1;
var RecPagine_last = RecPagine_first + RecPagine_numRows - 1;
// if we have the correct record count, check the other stats
if (RecPagine_total != -1) {
RecPagine_numRows = Math.min(RecPagine_numRows, RecPagine_total);
RecPagine_first = Math.min(RecPagine_first, RecPagine_total);
RecPagine_last = Math.min(RecPagine_last, RecPagine_total);
}
%>
<%
// *** Recordset Stats: if we don't know the record count, manually count them
if (RecPagine_total == -1) {
// count the total records by iterating through the recordset
for (RecPagine_total=0; !RecPagine.EOF; RecPagine.MoveNext()) {
RecPagine_total++;
}
// reset the cursor to the beginning
if (RecPagine.CursorType > 0) {
if (!RecPagine.BOF) RecPagine.MoveFirst();
} else {
RecPagine.Requery();
}
// set the number of rows displayed on this page
if (RecPagine_numRows < 0 || RecPagine_numRows > RecPagine_total) {
RecPagine_numRows = RecPagine_total;
}
// set the first and last displayed record
RecPagine_last = Math.min(RecPagine_first + RecPagine_numRows - 1, RecPagine_total);
RecPagine_first = Math.min(RecPagine_first, RecPagine_total);
}
%>
<html>
<body>
<% while ((Repeat1__numRows-- != 0) && (!RecPagine.EOF)) { %>
<h2><%=(RecPagine.Fields.Item("Titolo").Value)%> </h2>
<%=(RecPagine.Fields.Item("Testo").Value)%>
<p class="postato">Postato il <span class="evid2"><%=(RecPagine.Fields.Item("Data").Va lue)%></span> | " tabindex="50">Scrivi | " tabindex="50">Commenti | </p>
</p>
<%
Repeat1__index++;
RecPagine.MoveNext();
}
%>
</body>
</html>

Rispondi quotando
