dynamic item counter from SQLServer 2014 in web form for Visual Studio 2015?

对着背影说爱祢 提交于 2019-12-20 05:15:41

问题


I'm new to this type of programming (management figures programming is programming... ugh), apologies in advance if my question seems convoluted or basic.

I'm creating a Windows Form App in Visual Studio 2015. I have it communicating and sharing with our SQL Server perfectly for every function but one. I'd like to place a "live" counter on the form, that updates a value every 3(or something) seconds. The counter's job would be to keep track of inventory being shipped out of our warehouse (just need to worry about getting that info from our SQL Server, which already has the capabilities, nothing before that) and display that information. Doesn't have to fancy, just accurate.

I've tried searching for answers for a while, but I'm not sure I'm using the right terms or maybe I've overlooked what I should be using for this process. I'm not looking for a complete solution, just a link to a site or some terminology help that describes what I need would be truly appreciated.

Thanks in advance everyone.


回答1:


Try following to run code every interval millisecond.

 public static void InitializeTimer()
 {
    var inerval = 3000;
    var timer = new System.Timers.Timer();
    timer.Elapsed += keep_track_of_inventory_being_shipped;
    timer.Interval = inerval;
    timer.Start();
  }

  private static void keep_track_of_inventory_being_shipped(object sender, System.Timers.ElapsedEventArgs e)
  {
    //your code here
  }


来源:https://stackoverflow.com/questions/34701204/dynamic-item-counter-from-sqlserver-2014-in-web-form-for-visual-studio-2015

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!