<%@ Import Namespace="system.web.HttpUtility"%>
事例:
<table cellspacing=0 cellpadding=0 width=98% border=0 align="center" valign="top">
<%
dim sqlBGC as String="select * from bigclass order by bigclassid desc"
dim mycmdBGC as oledbcommand=new oledbcommand(sqlBGC,myconn)
dim myreaderBGC as oledbdatareader=mycmdBGC.executereader()
Dim BGCNextResult As Boolean = True
Do Until Not BGCNextResult
Do While myReaderBGC.Read()
dim bgcName=HttpUtility.UrlEncode(myreaderBGC.item("BigClassName"))
%>
<%InTable("middle2")%>
<tr>
<td height=17 bgcolor="" class=MainTitle> <a href="bigclass.aspx?bigclassname=<%=bgcName%>"><%=myReaderBGC.item("BigClassName")%></a></td>
<td height=17 bgcolor="" align="right"><a href="bigclass.aspx?bigclassname=<%=bgcName%>"><img src="images/more11.jpg" width="51" height="20" border="0" alt="更多新闻"></a></td>
</tr>
<%InTable("middle2")%>
<tr>
<td style="BORDER-LEFT: 1px double; BORDER-BOTTOM: 1px double"
align="top" height="100" bgcolor="" colspan="2" valign="top">
<!-- 小类内容 -->
<%
dim aa as string=myReaderBGC.item("BigClassName")
dim SmallContent as string="provider=microsoft.jet.oledb.4.0; data source="+server.MapPath("./data/access/db.mdb")
dim myconnSmallContent as oledbconnection=new oledbconnection(SmallContent)
myconnSmallContent.open()
dim strSQLSmall as String="select top 6 * from news where bigclassname='"+aa+"' order by newsid desc"
dim mycmdSmallContent as OleDBCommand=new oledbcommand(strSQLSmall,myconnSmallContent)
dim myreaderSmallContent As oledbdatareader=mycmdSmallContent.executereader()
%>
<table width="95%" border="0" align="top" cellpadding="0" cellspacing="0" style="TABLE-LAYOUT: fixed" valign="top">
<%
Dim SmallContentNextResult As Boolean = True
Do Until Not SmallContentNextResult
Do While myReaderSmallContent.Read()
%>
<tr>
<td style="WORD-WRAP: break-word" class=MainContentS align="top" valign="top"><a href="shownews.aspx?newsid=<%=myreaderSmallContent.item("newsid")%>" target="_blank" title="<%=myreaderSmallContent.item("title")%>" class="news"><%=myreaderSmallContent.item("title")%></a>
</td>
</tr>
<%
Loop
SmallContentNextResult = myReaderSmallContent.NextResult()
Loop
myReaderSmallContent.close()
myconnSmallContent.close()
%>
</table>
</td>
</tr>
<%
Loop
BGCNextResult = myReaderBGC.NextResult()
Loop
myReaderBGC.close()
%>
</table>
<!-- 中间最下 -->
<table width="98%" border="0" cellspacing="0" cellpadding="0" align="center">
<tr><td></td></tr>
<tr><td></td></tr>
</table>
</td>
读取:
dim PageName as String="bigclass"
dim strBGN=Request("BigClassName")
Dim BGName As String = HttpUtility.UrlDecode(strBGN)