散50分不够在加!顶者有分!提问!快进来看看帮帮忙!
排名显示问题!
数据表 A表:AutoPrice B表:AutoInfo
A表的auto_browse_num这个字段是记录访问次数的字段int类型,也就是说要从A表中的auto_browse_num这个字段中查找出访问次数最多的前十名。
B表的autobrand这个字段是产品系列字段。
B表的autotype这个字段是产品的集体型号字段。
也就是说排名出来之后得显示具体是哪一个产品的访问次数多!
存储过程
CREATE PROCEDURE AutoPrice_10GetList
AS
select top 10 a.[auto_browse_num],b.[autobrand],b.[autotype] from AutoPrice a,AutoInfo b where a.AutoID=b.AutoID order by auto_browse_num desc
GO
LookedClass.cs类代码:
public class AutoPm
{
public string Pm;
public string PmName;
public string PmName1;
}
public class LookedClass
{
public static AutoPm Pm()
{
SqlConnection con = showclass.datacon.AutoCon();
SqlCommand cmd = new SqlCommand( "AutoPrice_10GetList ",con);
con.Open();
AutoPm Pm = new AutoPm();
SqlDataReader sdr = cmd.ExecuteReader();
if( sdr.Read() )
{
Pm.Pm = sdr[ "auto_browse_num "].ToString(); //显示访问次数
Pm.PmName = sdr[ "autobrand "].ToString(); //显示具体系列
Pm.PmName1 = sdr[ "autotype "].ToString(); //显示具体型号
}
sdr.Close();
con.Close();
return Pm;
}
}
.aspx.cs页面代码:
public class Looked : System.Web.UI.Page
{
public AutoColumns.Demonstration.AutoPm PmNo = new AutoColumns.Demonstration.AutoPm();
private void Page_Load(object sender, System.EventArgs e)
{
PmNo = AutoColumns.Demonstration.LookedClass.Pm();
}
}
.aspx HMTL代码:
<p align= "center "> <%=PmNo.PmName%> <%=PmNo.PmName1%> </td>
<td width= "65 " bgcolor= "#FAFAFA " style= "font-size: 12px ">
<p align= "center "> <%=PmNo.Pm%> </td>
<p align= "center "> <%=PmNo.PmName%> <%=PmNo.PmName1%> </td>
<td width= "65 " bgcolor= "#FAFAFA " style= "font-size: 12px ">
<p align= "center "> <%=PmNo.Pm%> </td>
<p align= "center "> <%=PmNo.PmName%> <%=PmNo.PmName1%> </td>
<td width= "65 " bgcolor= "#FAFAFA " style= "font-size: 12px ">
<p align= "center "> <%=PmNo.Pm%> </td>
<p align= "center "> <%=PmNo.PmName%> <%=PmNo.PmName1%> </td>
<td width= "65 " bgcolor= "#FAFAFA " style= "font-size: 12px ">
<p align= "center "> <%=PmNo.Pm%> </td>
<p align= "center "> <%=PmNo.PmName%> <%=PmNo.PmName1%> </td>
<td width= "65 " bgcolor= "#FAFAFA " style= "font-size: 12px ">
<p align= "center