本文介绍了如何在sql中设置位true的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 我有网页表格并正确插入数据。对于一名员工,我在表格中有多条记录。 EmployeeStatus empStatus = new 的employeeStatus(); empStatus.Employee_Id = Employee.Id; empStatus.EmployeeStatusType_Id = SafeConvert.ToByte(ddlEmpStatus.SelectedValue); empStatus.StartDate = SafeConvert.ToDateTime(txtStartDate.Text); empStatus.EndDate = SafeConvert.ToDateTime(txtEndDate.Text); empStatus.Sector_Id = SafeConvert.ToByte(ddlSelectSector.SelectedValue); empStatus.Rank_Id = SafeConvert.ToByte(ddlRank.SelectedValue); empStatus.IsDutiable = txtIsDutiable.Checked; empStatus.HasWirles = txtHasWirles.Checked; empStatus.DutyType_Id = SafeConvert.ToByte(ddlDutyType.SelectedValue); empStatus.EmployeeShift_Id = SafeConvert.ToByte(ddlEmployeeShift.SelectedValue); _service.InsertEmployeeStatus(empStatus); _queryStatus = empStatus.Id > 0 ; i已尝试所有最后和默认方法,orderby等,但结果正常。因为对一名员工有不同的状态和不同的职责类型,所以我有一个想法,我在该表中添加一个新的列,这是一个类型,当我插入新的记录对该员工位设置为真的最后一个记录和以前的记录被设置为假>>该怎么样的出租车是使用c#完成。解决方案 i have web form and data is inserted properly.against one employee i have multiple records in the table.EmployeeStatus empStatus = new EmployeeStatus(); empStatus.Employee_Id = Employee.Id; empStatus.EmployeeStatusType_Id = SafeConvert.ToByte(ddlEmpStatus.SelectedValue); empStatus.StartDate = SafeConvert.ToDateTime(txtStartDate.Text); empStatus.EndDate = SafeConvert.ToDateTime(txtEndDate.Text); empStatus.Sector_Id = SafeConvert.ToByte(ddlSelectSector.SelectedValue); empStatus.Rank_Id = SafeConvert.ToByte(ddlRank.SelectedValue); empStatus.IsDutiable = txtIsDutiable.Checked; empStatus.HasWirles = txtHasWirles.Checked; empStatus.DutyType_Id = SafeConvert.ToByte(ddlDutyType.SelectedValue); empStatus.EmployeeShift_Id = SafeConvert.ToByte(ddlEmployeeShift.SelectedValue); _service.InsertEmployeeStatus(empStatus); _queryStatus = empStatus.Id > 0;i have tried all last&default method,orderby,etc but result is getting properly.because against one employee there are different status and different duty type, so i got one idea that i add a new column in that table which is a bit type,and when i insert new record against that employee bit is set true for that last record and for previous records is set false>>how that cab be done using c#. 解决方案 这篇关于如何在sql中设置位true的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
09-23 08:03