[求助]根据用户提交的出生日期自动计算用户年龄显示结果为空白
我做了一个体检查询系统其实一个功能是根据用户提交的出生日期,在查看用户注册信息界面时自动计算用户的年龄并显示出来,以下是关键代码:<body><%dim userBirth
userBirth=request.form("Byear")&"-"&request.form("Bmonth")&"-"&request.form("Bday")%>
<p align="center" class="STYLE1">用户的个人资料</p>
<table width="780" border="1" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="105" height="20" align="center"><span class="style9">体检单号</span></td>
<td width="105" height="20" align="center"><span class="style9">姓名</span></td>
<td width="105" height="20" align="center"><span class="style9">密码</span></td>
<td width="105" height="20" align="center"><span class="style9">性别</span></td>
<td width="105" height="20" align="center"><span class="style9">出生日期</span></td>
<td width="105" height="20" align="center">年龄</td>
<td width="105" height="20" align="center"><span class="style9">工作单位</span></td>
<td width="105" height="20" align="center"><span class="style9">电子邮箱</span></td>
</tr>
<%do while not rs.eof%>
<tr>
<td width="105" height="20" align="center"><span class="style9"><%=rs("Tijiandanhao")%></span></td>
<td width="105" height="20" align="center"><span class="style9"><%=rs("UserName")%></span></td>
<td width="105" height="20" align="center"><span class="style9"><%=rs("UserPass")%></span></td>
<td width="105" height="20" align="center"><span class="style9"><%=rs("UserSex")%></span></td>
<td width="105" height="20" align="center"><span class="style9"><%=rs("UserBirth")%></span></td>
<td width="105" height="20" align="center"><span class="style9"><%=rs("UserAge")=Datediff("yyyy",cdate(UserBirth),date())%></span></td>
<td width="105" height="20" align="center"><span class="style9"><%=rs("UserDepartment")%></span></td>
<td width="105" height="20" align="center"><span class="style9"><%=rs("UserEmail")%></span></td>
我在数据表中将出生日期这个字段设置为时间/日期型的
这句有问题吗:userBirth=request.form("Byear")&"-"&request.form("Bmonth")&"-"&request.form("Bday")