I have a data table from which i am filtering data based on condition,but how to display 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
Dim view As New DataView(MyDataTable)
Dim distinctValues As DataTable = view.ToTable(True, "ColumnA")
Try like This
TempDt =New DataView(Rows.CopyToDataTable()).ToTable(False,
"columnname1", "name2","...","..")
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.