针对C#DataTable的CTE查询 [英] CTE Query Against C# DataTable
问题描述
有人可以提供一个如何针对C#DataTable运行CTE查询的示例吗?
Can someone provide an example of how to run a CTE query against a C# DataTable?
推荐答案
不,你不能这样做。 CTE只存在于SQL Server中。 C#DataTable(System.Data.DataTable)不包含此类功能。
No, you can't do that. The CTE is something that only exists in the SQL Server. The C# DataTable (System.Data.DataTable) does not contain such functionality.
您可以填充一个DataTable,其结果是在SQL Server上执行查询。查询可以包含一个CTE,但这对于C#代码及其DataTable是完全透明的,它们不知道SQL
查询的内部结构。 CTE只针对SQL Server运行,而不针对DataTable运行。
You can fill a DataTable with the result of executing a query on the SQL Server. The query MAY contain a CTE, but this will be completely transparent for the C# code and its DataTable, which are unaware of the internal structure of the SQL query. The CTE will only run against the SQL Server, not against the DataTable.
这篇关于针对C#DataTable的CTE查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!