Fatto! Esempio:
codice:
<asp:repeater ID="RepEventi" runat="server">
<itemtemplate>
<tr>
<td nowrap class="c1">
<asp:label ID="Label3" runat="server">
<%# DataBinder.Eval(Container.DataItem, "giorno") %>/<%# DataBinder.Eval(Container.DataItem, "mese") %>/<%# DataBinder.Eval(Container.DataItem, "anno") %>
</asp:label>
</td>
<td width="100%" class="c1">
<asp:label ID="Label1" runat="server" CssClass="boldred1">
<%# DataBinder.Eval(Container.DataItem, "titolo") %>
</asp:label>
</td>
</tr>
<tr>
<td colspan="2" class="cella3">
<table width="100%" border="0" cellpadding="0" cellspacing="3" bgcolor="#FFEEE9" class="testo">
<tr>
<td bgcolor="#FFF3F0">
<asp:label ID="Label4" runat="server" Text='<%#StrTesto((string)DataBinder.Eval(Container.DataItem,
"testo"))%>'></asp:label>
<a href="news.aspx?id=<%# DataBinder.Eval(Container.DataItem, "id") %>">(Leggi
tutto l'articolo)</a> </td>
</tr>
</table></td>
</tr>
</itemtemplate>
</asp:repeater>
</table>
codice:
string tableName = "news";
string ordine = "anno DESC, mese DESC, giorno";
conn.Open();
OleDbDataAdapter da;
OleDbCommand comm;
comm = new OleDbCommand("Select top 3 * FROM " + tableName + " ORDER BY " + ordine + " DESC", conn);
da = new OleDbDataAdapter(comm);
ds = new DataSet();
da.Fill(ds, "Tabella");
pagedData.DataSource = ds.Tables["Tabella"].DefaultView;
RepEventi.DataSource = pagedData;
RepEventi.DataBind();
conn.Close();