【发布时间】:2014-09-23 14:33:49
【问题描述】:
有什么方法可以让 ms sql 表在每次表更改时发送信息? 我希望每次有人向表中插入值时更改 ToolStripMenuItem 的标题。
我做了一个计时器,每x秒更新一次,但如果它只在sql表发生变化时更新会更好。
我的代码:
//Rexton ordre klar til bestilling
command.CommandText = "SELECT COUNT(*) from bestillinger WHERE firma = @rexton and udlevering BETWEEN @date and @dateadd";
command.Parameters.AddWithValue("@bernafon", "Bernafon");
command.Parameters.AddWithValue("@gn_resound", "GN Resound");
command.Parameters.AddWithValue("@oticon", "Oticon");
command.Parameters.AddWithValue("@phonak", "Phonak");
command.Parameters.AddWithValue("@rexton", "Rexton");
command.Parameters.AddWithValue("@siemens", "Siemens");
command.Parameters.AddWithValue("@widex", "Widex");
con.Open();
command.ExecuteNonQuery();
string result = command.ExecuteScalar().ToString();
con.Close();
if (result != "0")
{
rextonToolStripMenuItem.Text = "rexton " + result;
rextonToolStripMenuItem.ForeColor = System.Drawing.ColorTranslator.FromHtml("#FF1919");
}
【问题讨论】:
-
@TimSchmelter 为什么不发表您的评论作为答案?