
谁能帮我解释一下这些ASP语句,越详细越好,解决问题追加分数.
<%'浏览新闻计数加1setrscount=conn.execute("select*fromnews")sql="UPDATEnewsSETnews_count=new...
<%
'浏览新闻计数加1
set rscount=conn.execute("select * from news")
sql="UPDATE news SET news_count = news_count + 1 where news_id="&clng(request.querystring("news_id"))
conn.execute (sql)
rscount.close
set rscount=Nothing
%>
<%
sql="select * from news where news_id="&clng(request.querystring("news_id"))
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,1
%>
<TABLE width="100%" border=0 cellPadding=0 cellSpacing=0>
<TBODY>
<TR valign="bottom">
<TD align="center"> <font color=ff6600><b><%=rs("news_title")%></b></font></TD>
<TD width="193" align="center"><font color=#999999>时间:<%=rs("news_date")%> 阅覧:<%=rs("news_count")%></font></TD>
</TR>
<TR>
<TD height=10 colspan="2">
<table width="100%" align="center" >
<tr>
<td><%=rs("news_content")%></td>
</tr>
</table></TD>
</TR>
<TR>
<TD colspan="2" background=images/main_heng.gif></TD>
</TR>
<TR>
<TD
height=10 colspan="2" align=right>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="85%"> </td>
<td width="15%"><img src="images/news_back.gif" width="8" height="5"><a href="javascript:history.back()"> back</a></td>
</tr>
</table></TD>
</tr>
</table>
</tr>
</TABLE>
<%
set rs=server.createobject("ADODB.Recordset")
sql="select * from P_info where p_other = 0 "
classType = request("classType")
smallclass = request("smallclass")
key = request("key")
if classType <> "" then
sql = sql & " and p_type = '"&classType&"'"
end if
if smallclass <> "" then
sql = sql & " and p_small_type = '"&smallclass&"'"
end if
if key <> "" then
sql = sql & " and p_name like '%"&key&"%'"
end if
sql = sql & " order by p_id desc"
rs.open sql,conn,1,1
if not isempty(request("page")) then
pagecount=cint(request("page"))
else
pagecount=1
end if
%>
<%
rs.close
set rs=nothing
%>
感谢evensky兄弟的回答,我因为是ASP盲,所以麻烦你能不能把前面那部分解释的再清楚一点,(读取对应ID新闻表格的内容,这里为重点,我的网站页面不能显示新闻内容。)我可以再追加些分数给你,谢谢了。前面我实在是看不太懂,麻烦你了。 展开
'浏览新闻计数加1
set rscount=conn.execute("select * from news")
sql="UPDATE news SET news_count = news_count + 1 where news_id="&clng(request.querystring("news_id"))
conn.execute (sql)
rscount.close
set rscount=Nothing
%>
<%
sql="select * from news where news_id="&clng(request.querystring("news_id"))
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,1
%>
<TABLE width="100%" border=0 cellPadding=0 cellSpacing=0>
<TBODY>
<TR valign="bottom">
<TD align="center"> <font color=ff6600><b><%=rs("news_title")%></b></font></TD>
<TD width="193" align="center"><font color=#999999>时间:<%=rs("news_date")%> 阅覧:<%=rs("news_count")%></font></TD>
</TR>
<TR>
<TD height=10 colspan="2">
<table width="100%" align="center" >
<tr>
<td><%=rs("news_content")%></td>
</tr>
</table></TD>
</TR>
<TR>
<TD colspan="2" background=images/main_heng.gif></TD>
</TR>
<TR>
<TD
height=10 colspan="2" align=right>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="85%"> </td>
<td width="15%"><img src="images/news_back.gif" width="8" height="5"><a href="javascript:history.back()"> back</a></td>
</tr>
</table></TD>
</tr>
</table>
</tr>
</TABLE>
<%
set rs=server.createobject("ADODB.Recordset")
sql="select * from P_info where p_other = 0 "
classType = request("classType")
smallclass = request("smallclass")
key = request("key")
if classType <> "" then
sql = sql & " and p_type = '"&classType&"'"
end if
if smallclass <> "" then
sql = sql & " and p_small_type = '"&smallclass&"'"
end if
if key <> "" then
sql = sql & " and p_name like '%"&key&"%'"
end if
sql = sql & " order by p_id desc"
rs.open sql,conn,1,1
if not isempty(request("page")) then
pagecount=cint(request("page"))
else
pagecount=1
end if
%>
<%
rs.close
set rs=nothing
%>
感谢evensky兄弟的回答,我因为是ASP盲,所以麻烦你能不能把前面那部分解释的再清楚一点,(读取对应ID新闻表格的内容,这里为重点,我的网站页面不能显示新闻内容。)我可以再追加些分数给你,谢谢了。前面我实在是看不太懂,麻烦你了。 展开
1个回答
展开全部
<%
'打开页面打开news表格,并对应ID新闻的阅读次数+1
set rscount=conn.execute("select * from news")
sql="UPDATE news SET news_count = news_count + 1 where news_id="&clng(request.querystring("news_id"))
conn.execute (sql)
rscount.close
set rscount=Nothing
%>
<%
'读取对应ID新闻表格的内容
sql="select * from news where news_id="&clng(request.querystring("news_id"))
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,1
%>
<TABLE width="100%" border=0 cellPadding=0 cellSpacing=0>
<TBODY>
<TR valign="bottom">
<TD align="center"> <font color=ff6600><b><%=rs("news_title")%></b></font></TD>
<TD width="193" align="center"><font color=#999999>时间:<%=rs("news_date")%> 阅覧:<%=rs("news_count")%></font></TD>
</TR>
<TR>
<TD height=10 colspan="2">
<table width="100%" align="center" >
<tr>
<td><%=rs("news_content")%></td>
</tr>
</table></TD>
</TR>
<TR>
<TD colspan="2" background=images/main_heng.gif></TD>
</TR>
<TR>
<TD
height=10 colspan="2" align=right>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="85%"> </td>
<td width="15%"><img src="images/news_back.gif" width="8" height="5"><a href="javascript:history.back()"> back</a></td>
</tr>
</table></TD>
</tr>
</table>
</tr>
</TABLE>
<%
'重新建立连接 从表p_info中查询p_other为0的数据
set rs=server.createobject("ADODB.Recordset")
sql="select * from P_info where p_other = 0 "
classType = request("classType") '获取浏览器提交的大类
smallclass = request("smallclass") '获取小类
key = request("key") '获取关键词
if classType <> "" then '在大类不为空的情况下
'SQL语句增加一个条件,即SQL="select * from P_info where p_other = 0 and p_type='"&classType&"'"
'从数据表p_info中查询p_other=0且大类为用户选择所选类的数据
sql = sql & " and p_type = '"&classType&"'"
end if
if smallclass <> "" then '如果小类不为空则增加一个条件进行查询
sql = sql & " and p_small_type = '"&smallclass&"'"
end if
if key <> "" then '如果关键词不空,再增加一个条件限制:筛选pname和关键词类似的数据
sql = sql & " and p_name like '%"&key&"%'"
end if
sql = sql & " order by p_id desc" '将所查询的数据按p_id降序排列
rs.open sql,conn,1,1
if not isempty(request("page")) then '页面不为空
pagecount=cint(request("page")) '则设为当前页
else '否则
pagecount=1 '当前页为首页
end if
%>
<%
rs.close
set rs=nothing
%>
'打开页面打开news表格,并对应ID新闻的阅读次数+1
set rscount=conn.execute("select * from news")
sql="UPDATE news SET news_count = news_count + 1 where news_id="&clng(request.querystring("news_id"))
conn.execute (sql)
rscount.close
set rscount=Nothing
%>
<%
'读取对应ID新闻表格的内容
sql="select * from news where news_id="&clng(request.querystring("news_id"))
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,1
%>
<TABLE width="100%" border=0 cellPadding=0 cellSpacing=0>
<TBODY>
<TR valign="bottom">
<TD align="center"> <font color=ff6600><b><%=rs("news_title")%></b></font></TD>
<TD width="193" align="center"><font color=#999999>时间:<%=rs("news_date")%> 阅覧:<%=rs("news_count")%></font></TD>
</TR>
<TR>
<TD height=10 colspan="2">
<table width="100%" align="center" >
<tr>
<td><%=rs("news_content")%></td>
</tr>
</table></TD>
</TR>
<TR>
<TD colspan="2" background=images/main_heng.gif></TD>
</TR>
<TR>
<TD
height=10 colspan="2" align=right>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="85%"> </td>
<td width="15%"><img src="images/news_back.gif" width="8" height="5"><a href="javascript:history.back()"> back</a></td>
</tr>
</table></TD>
</tr>
</table>
</tr>
</TABLE>
<%
'重新建立连接 从表p_info中查询p_other为0的数据
set rs=server.createobject("ADODB.Recordset")
sql="select * from P_info where p_other = 0 "
classType = request("classType") '获取浏览器提交的大类
smallclass = request("smallclass") '获取小类
key = request("key") '获取关键词
if classType <> "" then '在大类不为空的情况下
'SQL语句增加一个条件,即SQL="select * from P_info where p_other = 0 and p_type='"&classType&"'"
'从数据表p_info中查询p_other=0且大类为用户选择所选类的数据
sql = sql & " and p_type = '"&classType&"'"
end if
if smallclass <> "" then '如果小类不为空则增加一个条件进行查询
sql = sql & " and p_small_type = '"&smallclass&"'"
end if
if key <> "" then '如果关键词不空,再增加一个条件限制:筛选pname和关键词类似的数据
sql = sql & " and p_name like '%"&key&"%'"
end if
sql = sql & " order by p_id desc" '将所查询的数据按p_id降序排列
rs.open sql,conn,1,1
if not isempty(request("page")) then '页面不为空
pagecount=cint(request("page")) '则设为当前页
else '否则
pagecount=1 '当前页为首页
end if
%>
<%
rs.close
set rs=nothing
%>
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询