English 中文(简体)
终止货币基金方案
原标题:Termination of a .net program
  • 时间:2012-04-19 18:39:06
  •  标签:
  • .net
  • vb.net

我在vb.net写道,我有一份申请。 当申请启动时,它便与我的ql数据库联网,以便获取一些数据,一旦完成,就着手进行。

问题在于,它有时被困在地板上,在要求不发生任何事情之后,我就意味着我计划停止。 这可能是因为互联网问题或服务器。

Is there a way the program can determine that x seconds has elapsed and it has not got any data, so self terminate it. I tried using timer to perform this action but as the program requests for data, it gets stuck, I mean it locks up and thus timer also locks up and only after task is done everything resumes.

我希望,当方案即将启动时,我可以开始一个时间,确定X秒已经过去,因此现在终止申请。

让我知道我如何能够这样做?

感谢

Cheers, Greatchap

问题回答

是的,正如你所说的那样,你可以使用一个时间,迫使人们在一段时间后离开。 然而,这将更有意义地使你在我的SqlConnection上抽出时间。

<代码>MySqlConnection.Connectiontimeout是你在这种情况下这样做的。

如果出于某种原因,你必须杀掉。 您可使用<条码>Process.GetCurrentProcess(......)。





相关问题
Manually implementing high performance algorithms in .NET

As a learning experience I recently tried implementing Quicksort with 3 way partitioning in C#. Apart from needing to add an extra range check on the left/right variables before the recursive call, ...

Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

How do I compare two decimals to 10 decimal places?

I m using decimal type (.net), and I want to see if two numbers are equal. But I only want to be accurate to 10 decimal places. For example take these three numbers. I want them all to be equal. 0....

Exception practices when creating a SynchronizationContext?

I m creating an STA version of the SynchronizationContext for use in Windows Workflow 4.0. I m wondering what to do about exceptions when Post-ing callbacks. The SynchronizationContext can be used ...

Show running instance in single instance application

I am building an application with C#. I managed to turn this into a single instance application by checking if the same process is already running. Process[] pname = Process.GetProcessesByName("...

How to combine DataTrigger and EventTrigger?

NOTE I have asked the related question (with an accepted answer): How to combine DataTrigger and Trigger? I think I need to combine an EventTrigger and a DataTrigger to achieve what I m after: when ...

热门标签