我有一个后台工作程序运行来复制一个巨大的文件(几GB),我想知道如何在副本中间取消该过程.我可以在复制之前检查CancellationPending属性,但在复制已经进行时不知道如何进行.
if (worker.CancellationPending) // check cancellation before copy
{
e.Cancel = true;
}
else
{
File.Copy("sourceFile", "destinationFile"); // need to cancel this
}
Run Code Online (Sandbox Code Playgroud)
请指教,谢谢!
我想从每个删除语句的相同条件(where子句)的多个表中删除数据.
delete from tblA where id in (select x.id from tblX x where name like N'%test%')
delete from tblB where id in (select x.id from tblX x where name like N'%test%')
delete from tblC where id in (select x.id from tblX x where name like N'%test%')
delete from tblD where id in (select x.id from tblX x where name like N'%test%')
Run Code Online (Sandbox Code Playgroud)
有没有办法声明一个列表来存储上面的select语句中的id?
我试过了:
declare @ids int
set @ids = select x.id from tblX x where name like N'%test%'
Run Code Online (Sandbox Code Playgroud)
但它抱怨说
子查询返回的值超过1.当子查询跟随=,!=,<,<=,>,> …
我有一个带有面板的Winform,它根据用户输入加载不同的用户控件.
// to load a user control
pnlContent.Controls.Add(uc1);
// to change to different user control
pnlContent.Controls.Clear();
pnlContent.Controls.Add(uc2);
Run Code Online (Sandbox Code Playgroud)
我注意到当我清除pnlContent并重新添加uc1时,uc1的Load事件不会被触发,即uc1的Load事件仅在uc1第一次被添加到pnlContent时被触发.
有没有办法在每次将用户控件添加到面板时始终触发Load事件?如果没有,我的选择是什么?
请指教.