是否有可能检查未保存的函数的返回值? [英] Is it possible to inspect the return value of a function that is not saved?

查看:200
本文介绍了是否有可能检查未保存的函数的返回值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是这个问题。如果我有一个执行返回一个值,但我没有在一个变量捕获值的操作的功能,有没有什么办法可以让同时用调试器逐句通过该值没有在即时窗口中运行该功能的第二次?

This is a slight variation of this question. If I have a function that performs an action that returns a value but I did not capture that value in a variable, is there any way I can get that value while stepping through with the debugger without running the function a 2nd time in the immediate window?

一个实际的例子

using (SqlConnection cnSqlConnect = OpenConnection(ConnectionString))
using (SqlCommand sqlCmd = new SqlCommand(command, cnSqlConnect))
{
    sqlCmd.ExecuteNonQuery();
}



有没有什么办法让 SQLCMD的价值.ExecuteNonQuery()不运行它两次?

推荐答案

是的,有!


  1. 在功能中断之前执行。

  2. 从命令窗口中运行的代码行你停在,用前缀?来查看结果。像这样:? sqlCmd.ExecuteNonQuery();

  3. 手动拖动黄色指针显示的下一行代码被执行到下一行,skpping过代码,您在命令窗口中运行。

  1. Break on the function before it executes.
  2. From the Command Window run the line of code you stopped on, prepended with a ? to view the results. Like this: ? sqlCmd.ExecuteNonQuery();
  3. Manually drag the yellow pointer showing the next line of code to be executed down to the next line, skpping over the code that you ran in the command window.

这将只执行一次,你的代码的效果,会让你查看结果。

This will have the effect of only executing your code once and will let you view the result.

有关详细信息,请参阅用命令窗口的基础。

For more information see the Basics of using the Command Window.

这篇关于是否有可能检查未保存的函数的返回值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆