Datum WarenkorbID Kundennummer Artikelnummer Anzahl
01. 05 2012 0 08154711 121 12,001
01. 05 2012 1 08154711 121 25,000
        37,001

Der ASP.NET Seitencode:
  <asp:Repeater ID="Repeater1" runat="server">  
       <HeaderTemplate>  
         <table style="font-family: Calibri" border="1">  
          <tr>  
            <td>Datum</td>  
            <td>WarenkorbID </td>  
            <td>Kundennummer</td>  
            <td>Artikelnummer</td>  
            <td>Anzahl</td>  
          </tr>  
      </HeaderTemplate>  
      <ItemTemplate>  
        <tr>  
          <td><%# Format(DataBinder.Eval(Container.DataItem, "Datum"), "dd. MMM yyyy")%> </td>  
          <td><%# DataBinder.Eval(Container.DataItem, "WarenkorbID")%> </td>  
          <td><%# DataBinder.Eval(Container.DataItem, "KundenNummer")%> </td>  
          <td style="text-align: Center"><%# DataBinder.Eval(Container.DataItem, "ArtikelNummer")%> </td>  
          <td style="text-align: Right"><%# DataBinder.Eval(Container.DataItem, "Anzahl")%> </td>  
        </tr>  
      </ItemTemplate>  
      <FooterTemplate>  
        <tr>  
          <td>&nbsp; </td>  
          <td>&nbsp; </td>  
          <td>&nbsp; </td>  
          <td>&nbsp; </td>  
          <td style="text-align: Center"><%#SumTotal()%> </td>  
        </tr>  
        </table>  
      </FooterTemplate>  
     </asp:Repeater>  

Der VB.NET Quellcode:

 Imports System.Data  
 Imports System.Data.SqlClient  
   
 Public Class datarepeater
            
   Inherits System.Web.UI.Page  
      
   Private con As New SqlConnection("Server=localhost;Database=YourDataBase;Trusted_Connection=True;")  
   
   Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load  
   
     con.Open()  
   
     Dim dtWarenkorb As New DataTable  
     Dim cmd As New SqlCommand("SELECT * FROM Warenkorb", con)  
     Dim da As New SqlDataAdapter(cmd)  
   
     da.Fill(dtWarenkorb)  
   
     repData.DataSource = dtWarenkorb  
     repData.DataBind()  
   
   End Sub  
   
   Public Function SumTotal() As Decimal  
   
     Dim dTotal As Decimal  
     Dim cmd As New SqlCommand("SELECT SUM(Anzahl) FROM Warenkorb", con)  
   
     dTotal = CDec(cmd.ExecuteScalar)  
   
     Return dTotal  
   
   End Function  
   
 End Class  
     © 2017 by A. Winter