我如何通过Tosector_Id获得全体员工 [英] How Do I Get Total Employee By Tosector_Id

查看:81
本文介绍了我如何通过Tosector_Id获得全体员工的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的代码asp

here is my code of asp

<label class="col-sm-2 control-label">
                   Select Sector:
               </label>
               <div class="col-sm-3">
                  <asp:DropDownList CssClass="form-control" runat="server" MaxLength="7" ID="ddlToSector" OnSelectedIndexChanged="ddlToSector_SelectedIndexChanged" AutoPostBack="true"></asp:DropDownList>
                    </div>
           <label class="col-sm-2 control-label">
               Strenght:
           </label>
           <div class="col-sm-1">
               <asp:TextBox runat="server" ID="txtStrenght" AutoPostBack="true" ></asp:TextBox>
           </div>
       </div>



code背后




code behind

var employeeCounts = _service.GetAllEmployeeDuty().Where(x => x.ToSector_Id == '2');
            txtStrenght.Text = employeeCounts.ToString();



我希望在选择某个扇区时,它会在此字段中显示总强度,而不是每个扇区都显示员工在工作表中有一个扇区ID存储。

简称来自employeeseduty表列名称ToSector_Id收集该扇区Id的所有员工并返回int中的总数


I want that when a sector is selected then it total strenght is display in this field,as against each employee there is a sector id is store in the duty table.
in short from employeeduty table column name ToSector_Id collect all the employee for this sector Id and return total no in int

推荐答案

创建存储过程将扇区作为参数,在SP中识别该扇区的员工数量。



返回值到C#,你得到了员工人数。



你可以参考

http://stackoverflow.com/questions/6341819/get-sql-data-and-show-it- in-a-text-box [ ^ ]



如何使用C#.net 将数据从sql数据库显示到文本框[ ^ ]
Create a stored procedure take the sector as parameter and in SP identify the number of employee against that sector.

Return the value to C# and you got the number of employees.

you may refer to
http://stackoverflow.com/questions/6341819/get-sql-data-and-show-it-in-a-text-box[^]
and
how to display data from sql database to textbox using C#.net[^]


这篇关于我如何通过Tosector_Id获得全体员工的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆