小编Moh*_*Lal的帖子

如何在for循环中迭代日期?

我有一些价值观.

 DateTime date=04/03/2015(date)
 Total Woring days=6 (total)
 Rotation Days=2 (rotationday)
 Shift Group=S1(this group contain two shift id 1 and 2)
Run Code Online (Sandbox Code Playgroud)

我想要轮班6天.但是每隔2天后,移位id 1旋转移动id 2,两天后再移动id 2旋转移位id 1等等......我的输出应该是

04/03/2015=1
05/03/2015=1
06/03/2015=2
07/03/2015=2
08/03/2015=1
09/03/2015=1
Run Code Online (Sandbox Code Playgroud)

我通过foreach循环获得shift id.我尝试了下面提到的方式但没有得到适当的结果.请帮我解决这个问题

SqlCommand cmd2 = new SqlCommand("select ShiftID from ShiftGroup  where  
ShiftName='" + ide + "'", conn2);
SqlDataAdapter sda2 = new SqlDataAdapter(cmd2);
DataSet ds4 = new DataSet();
var rows2 = ds4.Tables[0].Rows;
if (ds4.Tables[0].Rows.Count > 0)
{
foreach (DataRow row2 in rows2)
{
string shiftname = Convert.ToString(row2["ShiftID"]);
DateTime date=04/03/2015(date)
Total …
Run Code Online (Sandbox Code Playgroud)

c# for-loop

6
推荐指数
1
解决办法
121
查看次数

如何在同一行左右对齐两个段落?

我想在一行上向左侧和右侧显示两段内容(可能是段落或文本).我的输出应该是这样的

 Name:ABC                                                               date:2015-03-02
Run Code Online (Sandbox Code Playgroud)

我怎样才能做到这一点?

c# pdf itextsharp

6
推荐指数
1
解决办法
1万
查看次数

标签 统计

c# ×2

for-loop ×1

itextsharp ×1

pdf ×1