针对C#DataTable的CTE查询 [英] CTE Query Against C# DataTable

查看:92
本文介绍了针对C#DataTable的CTE查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人可以提供一个如何针对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屋!

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