CTE Query Against C# DataTable RRS feed

  • Question

  • Can someone provide an example of how to run a CTE query against a C# DataTable?
    Thursday, March 7, 2019 4:41 PM

All replies

  • 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.

    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.

    Thursday, March 7, 2019 8:35 PM