AllComentlist.aspx.cs
(开头部分) 3KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
public partial class AllComentlist : System.Web.UI.Page
{
SqlHelper dbcoment = new SqlHelper();
public string BookId;
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
this.Title = "所有评论";
GetListPage();
GetCommentInfo();
}
}
public void GetCommentInfo()
{
BookId = Page.Request.QueryString["id"];
float all = float.Parse(dbcoment.ReturnSql("select count(*) from CommentInfo where BookId=" + BookId));
float haoping = float.Parse(dbcoment.ReturnSql("select count(*) from CommentInfo where leibie='好评' and BookId=" + BookId));
float zhongping = float.Parse(dbcoment.ReturnSql("select count(*) from CommentInfo where leibie='中评' and BookId=" + BookId));
float chaping = float.Parse(dbcoment.ReturnSql("select count(*) from CommentInfo where leibie='差评' and BookId=" + BookId));
Label1.Text = ((haoping / all) * 100).ToString() + "%";
Label2.Text = ((haoping / all) * 100).ToString() + "%";
Label3.Text = ((zhongping / all) * 100).ToString() + "%";
Label4.Text = ((chaping / all) * 100).ToString() + "%";
}
private void GetListPage()
{
string id = Page.Request.QueryString["id"];
try
{
SqlConnection con = new SqlConnection(SqlHelper.connstring);
con.Open();
SqlDataAdapter sda = new SqlDataAdapter("select * from CommentInfo where BookId='" + id + "' order by Addtime desc ", con);
DataSet ds = new DataSet();
sda.Fill(ds);
PagedDataSource objPds = new PagedDataSource();
objPds.DataSource = ds.Tables[0].DefaultView;
objPds.AllowPaging = true;
objPds.PageSize = 10;
int CurPage;
if (Request.QueryString["Page"] != null)
CurPage = Convert.ToInt32(Request.QueryString["Page"]);
else
后面还有 40 行代码,购买后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读 AI
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
