需要计算一周中每天记录的数据量
这有什么不对:
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://www.springframework.org/tags" prefix="spring" %>
<%@ taglib uri="http://www.springframework.org/tags/form" prefix="form" %>
<%@ page contentType="text/html;charset=UTF-8" %>
<%@ page session="true" %>
<html>
<body>
<nav class="col-lg-5 col-md-5 col-sm-5">
<ul class="pull-right">
<li class="purple"><a href="#"><i class="icons icon-user-3"></i> Login</a>
<ul id="login-dropdown" class="box-dropdown">
<li>
<form id="form" action="<c:url value='/j_spring_security_check'/>" method="POST">
<div class="box-wrapper">
<h4>LOGIN</h4>
<div class="iconic-input">
<input type="text" placeholder="Username" name="j_username" id="j_username">
<i class="icons icon-user-3"></i>
</div>
<div class="iconic-input">
<input type="password" placeholder="Password" name="j_password" id="j_password">
<i class="icons icon-lock"></i>
</div>
<input type="checkbox" id="_spring_security_remember_me" name="_spring_security_remember_me"> <label for="_spring_security_remember_me">Remember me</label>
<br>
<br>
<div class="pull-left">
<input name="submit" type="submit" class="orange" value="Login">
</div>
<div class="pull-right">
<a href="#">Forgot your password?</a>
<br>
<a href="#">Forgot your username?</a>
<br>
</div>
<br class="clearfix">
</div>
<div class="footer">
<h4 class="pull-left">NEW CUSTOMER?</h4>
<a class="button pull-right" href="create_an_account.html">Create an account</a>
</div>
</form>
</li>
</ul>
</li>
<li><a href="#"><i class="icons icon-lock"></i> Create an Account</a></li>
</ul>
</nav>
<c:url var="add" value="/displayproducts" ></c:url>
<form:form action="${add}" commandName="product">
<table>
<tr>
<td>
<form:label path="productname">
<spring:message text="productname"/>
</form:label>
</td>
<td>
<form:input path="productname" />
</td>
</tr>
<tr>
<td>
<input name="submit" type="submit" value="Submit" />
</td>
</tr>
</table>
</form:form>
<c:url var="addAction" value="/user/add" ></c:url>
<form:form action="${addAction}" commandName="user">
<div class="row">
<div class="col-lg-12 col-md-12 col-sm-12 register-account">
<div class="carousel-heading no-margin">
<h4>Register</h4>
</div>
<div class="page-content">
<div class="row">
<div class="col-lg-12 col-md-12 col-sm-12">
<p><strong>Tausch information</strong></p>
</div>
<div class="col-lg-4 col-md-4 col-sm-4">
<p>E-Mail*</p>
</div>
<div class="col-lg-8 col-md-8 col-sm-8">
<form:input type="text" path="email"/>
</div>
</div>
<div class="row">
<div class="col-lg-4 col-md-4 col-sm-4">
<p>Username*</p>
</div>
<div class="col-lg-8 col-md-8 col-sm-8">
<form:input type="text" path="username"/>
</div>
</div>
<div class="row">
<div class="col-lg-4 col-md-4 col-sm-4">
<p>Password</p>
</div>
<div class="col-lg-8 col-md-8 col-sm-8">
<form:input type="password" path="password"/>
</div>
</div>
<div class="row">
<div class="col-lg-12 col-md-12 col-sm-12">
<input class="big" type="submit" value="<spring:message text="Register"/>">
<input class="big" type="reset" value="Cancel">
</div>
</div>
</div>
</div>
</form:form>
</body>
</html>
代码未提供所需的输出。
答案 0 :(得分:0)
var collection = dtHour.AsEnumerable()
.GroupBy(item => item.Field<string>("Day Logged"))
.Select(item => new { DayOfWeek = item.Key, Count = item.Count());
以您想要的方式打印:
Console.WriteLine("Day of week - Count");
foreach(var item in collection)
{
Console.WriteLine(item.DayOfWeek + " - " + item.Count);
}