---
title: "how to select specific columns from a data table in vb.net?"  
description: "how to select specific columns from a data table in vb.net?"  
author: "Anonymous User"  
published: 2014-12-05  
updated: 2014-12-06  
canonical: https://www.mindstick.com/forum/12752/how-to-select-specific-columns-from-a-data-table-in-vb-dot-net  
category: ".net"  
tags: ["vb.net"]  
reading_time: 1 minute  

---

# how to select specific columns from a data table in vb.net?

I have a data [table](https://www.mindstick.com/articles/43918/how-to-design-table-using-bootstrap) from which i am [filtering data](https://www.mindstick.com/forum/160900/how-to-use-searching-and-filtering-data-in-an-sql-server) based on [condition](https://www.mindstick.com/forum/12711/select-query-with-and-condition),but how to display [specific columns](https://www.mindstick.com/forum/159131/how-to-find-all-tables-in-oracle-that-have-specific-columns) only from the data table?

```
Dim Dt As New DataTable                Dim SQlDa As SqlDataAdapter = New SqlDataAdapter(SqlCmd)                SQlDa.Fill(TrackingDt)                Dim Rows() As DataRow = Dt.Select("State = " + "'" + State + "'")                Dim TempDt As New DataTable                If Rows.Length > -1 Then                    TempDt = Rows.CopyToDataTable()                End If                Return TempDt
```

## Replies

### Reply by Anonymous User

Try like This

TempDt =New DataView(Rows.CopyToDataTable()).ToTable(False,

"columnname1", "name2","...","..")

### Reply by Anonymous User

Dim view As New DataView(MyDataTable)

Dim distinctValues As DataTable = view.ToTable(True, "ColumnA")


---

Original Source: https://www.mindstick.com/forum/12752/how-to-select-specific-columns-from-a-data-table-in-vb-dot-net

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
