发布网友 发布时间:2022-04-26 09:13
共5个回答
热心网友 时间:2022-06-26 12:30
<%
sql="select top 3 * from NEWS where firstImageName<>'' and ok=true order by ID DESC"
set rs=conn.execute(sql)
if rs.eof and rs.bof then
response.write "<tr><br><br><br><br><td align=center colspan=2 bgcolor=#E8E8F4>精彩活动稍后推出</td></tr>"
else
Do While Not RS.EOF
%>
<table id='time' width='175' border='0' cellpadding='0' cellspacing='0'>
<tr height='16'>
<td height='16' width="226"><a href="onews.asp?id=<%=rs("id")%>" target="_blank" ><p align="left"><font color='#ff3300'><b><%=left(rs("title"),12)%></b></font></p></a></td>
</tr>
<tr>
<td width="226">
<p align="center"><a href="onews.asp?id=<%=rs("id")%>" target="_blank" ><img src="uppic/<%=trim(rs("firstImageName"))%>" width="224" height="253" border="0"></a></p>
</td>
</tr>
</table>
<%
RS.MoveNext
Loop
end if
rs.close
set conn=nothing
%>
应该是:
%
sql="select top 3 * from NEWS where firstImageName<>'' and ok=true order by ID DESC"
set rs=conn.execute(sql)
if rs.eof and rs.bof then
response.write "<tr><br><br><br><br><td align=center colspan=2 bgcolor=#E8E8F4>精彩活动稍后推出</td></tr>"
else %>
<table id='time' width='175' border='0' cellpadding='0' cellspacing='0'>
<%
Do While Not RS.EOF
IF INT(T/5)=T/5 THEN
%>
<tr height='16'> <%END IF%>
<td height='16' width="226"><a href="onews.asp?id=<%=rs("id")%>" target="_blank" ><p align="left"><font color='#ff3300'><b><%=left(rs("title"),12)%></b></font></p></a></td>
<% T=T+1 %>
''下面同样处理
</tr>
<tr>
<td width="226">
<p align="center"><a href="onews.asp?id=<%=rs("id")%>" target="_blank" ><img src="uppic/<%=trim(rs("firstImageName"))%>" width="224" height="253" border="0"></a></p>
</td>
</tr>
<%
RS.MoveNext
Loop
end if
rs.close
set conn=nothing
%>
</table>
热心网友 时间:2022-06-26 12:30
太简单啦,来试试
我,先声名哦,你们面的表格并没有结束,你插入时最好是照着原来的地方插入,后面应该有结束表格的,这样就不会乱了,我只是加了个表格进去,嘿嘿
<%
sql="select top 3 * from NEWS where firstImageName<>'' and ok=true order by ID DESC"
set rs=conn.execute(sql)
if rs.eof and rs.bof then
response.write "<tr><br><br><br><br><td align=center colspan=2 bgcolor=#E8E8F4>精彩活动稍后推出</td></tr>"
else
%>
<table id='time1' width='100%' border='0' cellpadding='0' cellspacing='0'>
<tr>
<%
Do While Not RS.EOF
%> <td valign="top">
<table id='time' width='175' border='0' cellpadding='0' cellspacing='0'>
<tr height='16'>
<td height='16' width="226"><a href="onews.asp?id=<%=rs("id")%>" target="_blank" ><p align="left"><font color='#ff3300'><b><%=left(rs("title"),12)%></b></font></p></a></td>
</tr>
<tr>
<td width="226">
<p align="center"><a href="onews.asp?id=<%=rs("id")%>" target="_blank" ><img src="uppic/<%=trim(rs("firstImageName"))%>" width="224" height="253" border="0"></a></p>
</td>
</tr>
</table> </td>
<%
RS.MoveNext
Loop
end if
rs.close
set conn=nothing
%></tr></table>
热心网友 时间:2022-06-26 12:31
<table id='time' width='175' border='0' cellpadding='0' cellspacing='0'>
<tr height='16'>
<td height='16' width="226"><a href="onews.asp?id=<%=rs("id")%>" target="_blank" ><p align="left"><font color='#ff3300'><b><%=left(rs("title"),12)%></b></font></p></a></td>
<td width="226">
<p align="center"><a href="onews.asp?id=<%=rs("id")%>" target="_blank" ><img src="uppic/<%=trim(rs("firstImageName"))%>" width="224" height="253" border="0"></a></p>
</td>
</tr>
</table>
<%
RS.MoveNext
Loop
end if
rs.close
set conn=nothing
%>
热心网友 时间:2022-06-26 12:31
将ASP纪录集输出成n列的的表格形式显示的方法
前些日子有网友问:将ASP纪录集输出成n列的的表格形式显示的方法,现在写了一个,方便大家使用。
'定义变量
Dim cn,rs,Sql
Sql = "select CustomerID from Orders"
'记录总数
Dim TotalNumbe
Set cn = Server.CreateObject("ADODB.Connection")
cn.Open "Provider=SQLOLEDB.1;User ID=sa;Initial Catalog=NorthWind;Data Source=.;Password=;"
Set rs = Server.CreateObject("ADODB.Recordset")
rs.Open Sql, cn, 3, 1
TotalNumber = rs.RecordCount
If TotalNumber = 0 Then
Response.Write "没有记录输出。"
Else
Dim jj,nLeft,cCol
jj = 0
nCol = 415
nLeft = nCol- (TotalNumber Mod nCol)
If nLeft = nCol Then nLeft = 0
Response.Write "<table border><tr>" & vbCrLf
While not rs.EOF
Response.Write "<td>" & rs("CustomerID") & "</td>" & vbCrLf
'If (jj Mod nCol) = (nCol - 1) And jj <> TotalNumber - 1 Then Response.Write "</tr><tr>" & vbCrLf
'If (jj Mod nCol) = (nCol - 1) And jj = TotalNumber-1 Then Response.Write "</tr>" & vbCrLf
If (jj Mod nCol) = (nCol - 1) Then
If jj <> TotalNumber - 1 Then
Response.Write "</tr><tr>" & vbCrLf
Else
Response.Write "</tr>" & vbCrLf
End If
End If
jj = jj + 1
rs.MoveNext
Wend
If nLeft <> 0 And nLeft <> nCol Then
If nCol < TotalNumber Then
For i = 1 to nLeft
Response.Write "<td> </td>" & vbCrLf
Next
End If
Response.Write "</tr>" & vbCrLf
End If
Response.Write "</table>"
End If
rs.Close
Set rs = Nothing
cn.Close
Set cn = Nothing
Response.End
热心网友 时间:2022-06-26 12:32
把第4和16行的center改成left