Using sql commands in datatable

Don75 81 Reputation points
2023-06-12T23:02:55.3333333+00:00

I would like to know whether it is possible to use select commands in a datatable in vb.net

In sql we could use #tablename to create, add edit temp tables. I am looking to do the same think in VB.Net. Could I use datatable to do that, if not any alternatives?

Developer technologies VB
Developer technologies ASP.NET Other
SQL Server Other
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Jiachen Li-MSFT 34,221 Reputation points Microsoft External Staff
    2023-06-13T01:40:39.1666667+00:00

    Hi @Don75 ,

    Have you considered using the DataTable.Select Method?

    Dim rows As DataRow() = dataTable.Select("ColumnName1 > 10 AND ColumnName2 < 5")
    
    Dim rows As DataRow() = dataTable.Select("ColumnName LIKE 'ABC%'")
    
    

    Best Regards.

    Jiachen Li


    If the answer is helpful, please click "Accept Answer" and upvote it.

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


  2. SurferOnWww 4,631 Reputation points
    2023-06-17T00:40:57.5433333+00:00

    Can the following Microsoft tutorial help?

    Get started with ASP.NET Core MVC

    Try to complete up to Part5. You will be able to crate the ASP.NET Core application which can create, add and edit the table of SQL Server database.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.