me_java9783 2014-06-10 08:18
浏览 659

C#循坏不运行,不循坏就可以运行

while(true)
{
Thread.Sleep(5000);
SqlConnection conn = new SqlConnection("server=.\sqlexpress;database=ERP;user id=sa;pwd=config;");
SqlCommand cmd = new SqlCommand("select top 1 * from ERPGongGao order by id desc", conn);
SqlCommand cmd1 = new SqlCommand("select top 1 * from ERPTelFile order by id desc", conn);
SqlDataAdapter sda = new SqlDataAdapter(cmd);
SqlDataAdapter sda1 = new SqlDataAdapter(cmd1);
DataSet ds = new DataSet();
DataSet ds1 = new DataSet();
sda.Fill(ds);
sda1.Fill(ds1);
conn.Open();
string nowTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm");
string timeStr = ds.Tables[0].Rows[0]["timeStr"].ToString().Substring(0, 16);
string timeStr1 = ds1.Tables[0].Rows[0]["timeStr"].ToString().Substring(0, 16);
string text = ds.Tables[0].Rows[0]["TitleStr"].ToString();
string text1 = ds1.Tables[0].Rows[0]["TitleStr"].ToString();
if (true)//(nowTime == timeStr)
{
string name = "公告:";
shouwindow(name, text);
//MessageBox.Show("办公平台提醒已经开启!有新消息会提醒。"+i);
}
else if (nowTime == timeStr1)
{
string name1 = "文件:";
shouwindow(name1, text1);
//MessageBox.Show("办公平台提醒已经开启!有新消息会提醒。");
}
conn.Close();
}

桌面小程序,不循坏就可以运行,循坏就不运行了.很久没做过C#程序了,也没报错,不好找问题啊!

  • 写回答

0条回答

    报告相同问题?

    悬赏问题

    • ¥15 素材场景中光线烘焙后灯光失效
    • ¥15 请教一下各位,为什么我这个没有实现模拟点击
    • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
    • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
    • ¥20 有关区间dp的问题求解
    • ¥15 多电路系统共用电源的串扰问题
    • ¥15 slam rangenet++配置
    • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
    • ¥15 ubuntu子系统密码忘记
    • ¥15 保护模式-系统加载-段寄存器