我想选择数据集中的所有列。数据集是从数据库表中检索的。
这是我的代码:
lstvCustomers.Items.Clear()
Dim result = (From cust In dsCust.Tables(0).AsEnumerable).ToList
'When i set where clause condition (Where cust.Field(Of String)("Ccd").Contains(txtCustID.Text))
' error occured in bellow line Error : The source contains not datarow
Dim custTable As DataTable = result.CopyToDataTable
lstvCustomers.Columns.Clear()
For cls As Integer = 1 To custTable.Columns.Count - 1
lstvCustomers.Columns.Add("COl - " & cls)
Next
Dim i As Integer = 0
For Each row In custTable.Rows
Dim lst As ListViewItem = lstvCustomers.Items.Add(row(0))
For cls As Integer = 1 To custTable.Columns.Count - 1
lst.SubItems.Add(row(cls))
Next
i = i + 1
Next
输出
Col1 COl2 COl3 COL4 Col5 COl6 COL7
Cust101 Cust101 True Cust101 Cust101 Cust101 232323
Cust102 Cust102 True Cust102 Cust102 Cust102 234324
我想从数据集中选择所有列。帮我。