Example #1
0
        public void BindData()
        {
            string sql = "";

            sql  = "select t.id ID,a.add_display  位置,d.resource_name 设备,t.start_time 开始,t.end_time 结束,tr.tru_name 指廊,ter.ter_name 航站楼,t.description 消息 from ";
            sql += " B_DEVICES_MSG t,b_devices_addtype a,b_devices_funtype f,b_devices d,b_terminals ter,b_trunks tr where";
            sql += " a.id(+)=t.addtype_id and f.id(+)=t.funtype_id and d.id(+)=t.devices_id and tr.tru_id(+)=t.tru_id and ter.ter_id(+)=t.ter_id";
            sql += " order by t.id desc";
            DataTable dt = ora.GetDt(sql);

            dgv_msg.DataSource = dt;
            for (int i = 0; i < dgv_msg.Columns.Count; i++)
            {
                if (dgv_msg.Columns[i].Name == "消息")
                {
                    dgv_msg.Columns[i].Width = 460;
                    // dgv_msg.Columns[i].DefaultCellStyle = Color.Red;
                    //break;
                }
                if (dgv_msg.Columns[i].Name == "ID" || dgv_msg.Columns[i].Name == "设备" || dgv_msg.Columns[i].Name == "指廊" || dgv_msg.Columns[i].Name == "航站楼")
                {
                    dgv_msg.Columns[i].Width = 65;
                }
            }
            // string sqlcount = "select count(*) from B_DEVICES_MSG t,b_devices_addtype a,b_devices_funtype f,b_devices d,b_terminals ter,b_trunks tr where a.id(+)=t.addtype_id and f.id(+)=t.funtype_id and d.id(+)=t.devices_id and tr.tru_id(+)=t.tru_id and ter.ter_id(+)=t.ter_id";
            label1.Text = "消息总数:" + ora.GetRecordCount(sql);
        }