如何根据日期更改Emp类别 [英] how do change Emp category base on date

查看:80
本文介绍了如何根据日期更改Emp类别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在sql中有一个表,如下面的结构

i have a table in sql like following structure

Id   Emp_Id       Category_Id    
1     sss             A
2     CCC             A
3     VVV             B
4     BBB             B



我使用以下代码从给定日期开始获取日期


I am using following code to get day from the given date

Int16 day = Convert.ToInt16(SafeConvert.ToDateTime(txtDate.Text).Day);



i希望如果当天甚至更改员工类别'A'更改为类别'B'和员工类别B更改为'A', IF天是奇数然后相反发生而不改变用户在表中存储的原始表值。


i want that if day is even then change employee with category 'A' Change to category 'B' and Employee with category B CHANGE TO 'A',IF day is odd then opposite happen without changing the original table value that is store in table by user.

推荐答案

这些链接将帮助您了解使用Entity Framework更新数据 -

在Entity Framework 4.0中添加,更新和删除对象 [ ^ ]

如何:添加,修改和删除对象 [ ^ ]

使用DBContext更新现有实体 [ ^ ]
These links will help you learn about updating data using Entity Framework -
Add, Update and Delete Objects in Entity Framework 4.0[^]
How to: Add, Modify, and Delete Objects[^]
Update Existing Entity using DBContext [^]


这篇关于如何根据日期更改Emp类别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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