📄 yonghuzhuce.aspx.cs
字号:
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
namespace free.bbs
{
/// <summary>
/// Summary description for yonghuzhuce.
/// </summary>
public partial class yonghuzhuce : System.Web.UI.Page
{
protected System.Web.UI.WebControls.Image Image2;
SqlCommand command;
SqlDataReader myread;
SqlDataAdapter myada;
DataSet ds;
HtmlTableRow myrow;
HtmlTableCell mycell;
SqlConnection monn;
DateTime time=DateTime.Today;
protected void Page_Load(object sender, System.EventArgs e)
{
try
{
shui.Text=Request.Cookies["huiyuan"].Value.ToString();
}
catch
{
shui.Text="游客";
}
DateTime time2=time.AddDays(1);
try
{
monn=new SqlConnection(Session["str_connection"].ToString());
}
catch
{
Response.Write("数据库连接错误!!");
}
// string mysql1="select count(yonghuming) from huiyuan where sheng='湖南'";
string jinri_zong="select count(huifu.huifu_id) from posts,huifu where posts.postid=huifu.post_id and (huifu.shijian between '"+time+"' and '"+time2+"')";
string tiezi_zong="select count(*) from huifu";
string zhuti_zong="select count(zhuti) from posts";
// string xinxi="select count(xiaoxi_id) from duanxiaoxi where shijian between (select lastlogin from huiyuan where yonghuming='"+Request.Cookies["huiyuan"].Value+"') and '"+time1.ToString()+"')";
monn.Open();
SqlCommand command34=new SqlCommand(zhuti_zong,monn);
SqlDataReader reader34=command34.ExecuteReader();
if(reader34.Read())
{
int shu=reader34.GetInt32(0);
zhuti.Text=shu.ToString();
reader34.Close();
}
SqlCommand command35=new SqlCommand(jinri_zong,monn);
SqlDataReader reader35=command35.ExecuteReader();
if(reader35.Read())
{
int shu=reader35.GetInt32(0);
tieshu.Text=shu.ToString();
reader35.Close();
}
SqlCommand mycommand36=new SqlCommand(tiezi_zong,monn);
SqlDataReader reader36=mycommand36.ExecuteReader();
if(reader36.Read())
{
int shu=reader36.GetInt32(0);
zongshu.Text=shu.ToString();
reader36.Close();
}
monn.Close();
binding();
// Put user code to initialize the page here
}
private void binding()
{
try
{
monn=new SqlConnection(Session["str_connection"].ToString());
}
catch
{
Response.Write("数据库连接错误!!");
}
string mysql="select sheng from huiyuan";
try
{
ds=new DataSet();
monn.Open();
myada=new SqlDataAdapter(mysql,monn);
myada.Fill(ds,"sheng");
if(ds.Tables["sheng"].Rows.Count>0)
try
{
for(int i=0;i<=ds.Tables["sheng"].Rows.Count-1;i++)
{
int j=i+1;
string sql="select count(yonghuming) from huiyuan where sheng='"+ds.Tables["sheng"].Rows[i]["sheng"].ToString()+"'";
command=new SqlCommand(sql,monn);
myread=command.ExecuteReader();
myread.Read();
int count=myread.GetInt32(0);
int chang=count+4;
if(chang>=520)
chang=520;
myread.Close();
myrow=new HtmlTableRow();
mycell=new HtmlTableCell();
string provice=ds.Tables["sheng"].Rows[i]["sheng"].ToString();
if(j>10&&j<=20)
{
j=i-9;
mycell.Controls.Add(new LiteralControl("<td class='tableBody2'>※"+provice+"※</td><td class='tableBody2'><img src='./tuli_pic/"+j+".gif' width="+chang+" height=10></td><td class='tableBody2' align='center'><font color='red' face='宋体'>"+count+"</font></td>"));
}
else if(j>20&&j<=30)
{
j=i-19;
mycell.Controls.Add(new LiteralControl("<td class='tableBody2'>※"+provice+"※</td><td class='tableBody2'><img src='./tuli_pic/"+j+".gif' width="+chang+" height=10></td><td class='tableBody2' align='center'><font color='red' face='宋体'>"+count+"</font></td>"));
}
else if(j>30)
{
j=i-29;
mycell.Controls.Add(new LiteralControl("<td class='tableBody2'>※"+provice+"※</td><td class='tableBody2'><img src='./tuli_pic/"+j+".gif' width="+chang+" height=10></td><td class='tableBody2' align='center'><font color='red' face='宋体'>"+count+"</font></td>"));
}
else
{
mycell.Controls.Add(new LiteralControl("<td class='tableBody2'>※"+provice+"※</td><td class='tableBody2'><img src='./tuli_pic/"+j+".gif' width="+chang+" height=10></td><td class='tableBody2' align='center'><font color='red' face='宋体'>"+count+"</font></td>"));
}
myrow.Cells.Add(mycell);
liu.Rows.Add(myrow);
}
monn.Close();
}
catch
{}
}
catch
{}
}
#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
}
#endregion
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -