获取由强类型数据集 (C#) 执行的 SQL
Get the SQL that was executed by a strongly typed dataset (C#)
不幸的是,我有很多使用强类型数据集的遗留 C# 代码。我的问题是如何获取填充强类型数据集时实际执行的 Select 语句?
如果您使用的是类型化数据集,那么您的所有过程都会映射到数据集中的正确方法(您可以在 designer.cs 中检查相同的方法)。
您可以 select 任何 method/procedure 并转到属性并检查 select 命令。
how do I get the Select Statement that was actually executed when the
Strongly Typed Dataset is filled?
我相信您正在使用 SqlDataAdapter
来填充类型化数据集。在这种情况下,您可以使用 SqlDataAdapter.SelectCommand
属性 like
da.SelectCommand.CommandText;
通常您会在数据集设计器的 TableAdapter 中看到 SQL 语句;右键单击并 select 'Configure'。但是,其中通常会有多个查询 - 您将必须检查源代码以确定调用哪个查询以及使用哪些参数。
不幸的是,我有很多使用强类型数据集的遗留 C# 代码。我的问题是如何获取填充强类型数据集时实际执行的 Select 语句?
如果您使用的是类型化数据集,那么您的所有过程都会映射到数据集中的正确方法(您可以在 designer.cs 中检查相同的方法)。
您可以 select 任何 method/procedure 并转到属性并检查 select 命令。
how do I get the Select Statement that was actually executed when the Strongly Typed Dataset is filled?
我相信您正在使用 SqlDataAdapter
来填充类型化数据集。在这种情况下,您可以使用 SqlDataAdapter.SelectCommand
属性 like
da.SelectCommand.CommandText;
通常您会在数据集设计器的 TableAdapter 中看到 SQL 语句;右键单击并 select 'Configure'。但是,其中通常会有多个查询 - 您将必须检查源代码以确定调用哪个查询以及使用哪些参数。