我有一个SQL脚本输出我需要的数据。现在我需要在我的网站上的HTML表格中显示它。我不确定我搞砸了什么,但数据没有显示在表格中,而是所有数据都显示在一行中,文字环绕着屏幕。
到目前为止,这是我的“billing.asp”页面(一旦我发现这个问题,我将添加更多内容):
<%@ Language=VBScript %>
<html>
<head>
<title></title>
</head>
<body>
<%
dim startdate
startdate = request.form("datestart")
dim enddate
enddate = request.form("dateend")
%>
<%
dim dbconn
set dbconn = server.createobject("adodb.connection")
DBCONN.CommandTimeout = 30000
DBCONN.ConnectionTimeout = 30000
dbconn.open "dsn=*****;uid=*****;pwd=*****"
'if dbconn.errors.count > 0 then
' response.write "connection erros<br>"
' for each objerr in dbconn.errors
' response.write objerr.source & "<br>"
' response.write objerr.description & "<br>"
' next
'end if
dim billingtrans
dim sqlstr
sqlstr = "SELECT sq.*, sq.Total - sq.[Update] as Inquiry from ( select f.cityName, t.[employee], sum (t.TransactionCount) as Total, sum (case when ([format] in (23,25,38) or [format] between 400 and 499 or [format] between 800 and 899) then t.TransactionCount else 0 end) as [Update] FROM [log].[dbo].[TransactionSummary] t INNER JOIN [log].[dbo].[city] f on t.cityNo = f.cityNo and t.employee = f.employee and t.subno = f.subno where t.transactiondate between '" + startdate + "' and '" + enddate + "' group by f.cityName,t.employee ) sq"
set billingtrans = server.createobject("adodb.recordset")
billingtrans.open sqlstr, dbconn
%>
<table id="billing">
<tr>
<td>City</td>
<td>Employee</td>
<td>Total</td>
<td>Update</td>
<td>Inquiry</td>
</tr>
<%
while not billingtrans.eof
response.write "<tr>"
response.write billingtrans("cityName") & "</td>"
response.write billingtrans("employee") & "</td>"
response.write billingtrans("Total") & "</td>"
response.write billingtrans("Update") & "</td>"
response.write billingtrans("Inquiry") & "</td>"
billingtrans.movenext
wend
billingtrans.close
dbconn.close
%>
</table>
</body>
</html>
答案 0 :(得分:1)
您未关闭window.fbAsyncInit = function () {
FB.init({
appId: '...',
xfbml: true,
version: 'v2.6'
});
};
而未关闭<tr>
中的</td>
。不相关,但您还应该在标题行中使用while
而不是<th>
。
如果您不使用<td>
,它也会更具可读性(并且更不容易出错)。
response.write