我用"throw;"重新抛出异常,但堆栈跟踪不正确:
static void Main(string[] args) {
try {
try {
throw new Exception("Test"); //Line 12
}
catch (Exception ex) {
throw; //Line 15
}
}
catch (Exception ex) {
System.Diagnostics.Debug.Write(ex.ToString());
}
Console.ReadKey();
}
Run Code Online (Sandbox Code Playgroud)
正确的堆栈跟踪应该是:
Run Code Online (Sandbox Code Playgroud)System.Exception: Test at ConsoleApplication1.Program.Main(String[] args) in Program.cs:Line 12
但我得到:
Run Code Online (Sandbox Code Playgroud)System.Exception: Test at ConsoleApplication1.Program.Main(String[] args) in Program.cs:Line 15
但第15行是"抛出"的位置.我用.NET 3.5进行了测试.
我有一个SQL查询的int参数的大列表:
update mytable set col='xyz'
where id in (/* thousands of ints */)
Run Code Online (Sandbox Code Playgroud)
我的问题是在SQL Server 2000中有参数限制.我也可以在SQL Server 2008上运行此查询.
有什么更好的方法来做到这一点.
编辑:
Ids列表来自C#程序.不是从另一张桌子.