web/WebUserControl11.ascx.cs

(完整代码) 1KB

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Configuration;
using System.Data;
public partial class web_WebUserControl11 : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        string ConnStr1 = System.Configuration.ConfigurationManager.ConnectionStrings["ConnStr"].ToString();
        SqlConnection cn = new SqlConnection(ConnStr1);
        String sql = "select  History.RoomId 房间号,RoomCategory.Name 房间类型名称,sum(TotalPrice) 每间房盈利,History.BeginTime 赢利开始时间,History.EndTime 赢利结束时间 from History,RoomsInfo,RoomCategory where History.RoomId=RoomsInfo.RoomId and RoomsInfo.RcategoryId=RoomCategory.RcategoryId and RoomCategory.Name='" + DropDownList1.SelectedItem + "' and History.EndTime is not null group by RoomCategory.Name,History.RoomId,History.BeginTime,History.EndTime";
        cn.Open();
        SqlCommand cmd = new SqlCommand(sql, cn);
        SqlDataAdapter da = new SqlDataAdapter(sql, cn);
        DataTable dt = new DataTable();
        da.Fill(dt);
        int i = dt.Rows.Count;
        float f = 0;
        for (int k = 0; k < i; k++)
        {
            string r = dt.Rows[k][2].ToString();
            //if (r.Equals(""))
            //{
            //    dt.Rows[k][4] = "在住";
            //}
           f =f+ float.Parse(r);

        }
        GridView1.DataSource = dt;
        GridView1.DataBind();
        cn.Close();
        Label2.Text = f.ToString();
    }


}

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。