WEB页面中文传值的编码与读取

<%@ 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>&nbsp;<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)

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值