F
fniles
Can I create an index on a DataTable ?
On the following DataTable, I would like to create index on "Price", can I
do that ?
Thank you.
Dim DT As New DataTable
DT.Columns.Add("Price", GetType(System.Int32))
DT.Columns.Add("ID", GetType(System.Int32))
DT.Columns.Add("Vol", GetType(System.Int32))
Dim r As DataRow = DT.NewRow
r.Item(0) = 99
r.Item(1) = 1234
r.Item(2) = 350
r.Item(3) = 1
DT.Rows.Add(r)
r = DT.NewRow
r.Item(0) = 98
r.Item(1) = 1233
r.Item(2) = 300
r.Item(3) = 1
DT.Rows.Add(r)
r = DT.NewRow
r.Item(0) = 97
r.Item(1) = 1230
r.Item(2) = 375
r.Item(3) = 1
DT.Rows.Add(r)
r = DT.NewRow
r.Item(0) = 96
r.Item(1) = 1231
r.Item(2) = 250
r.Item(3) = 1
DT.Rows.Add(r)
DT.AcceptChanges()
On the following DataTable, I would like to create index on "Price", can I
do that ?
Thank you.
Dim DT As New DataTable
DT.Columns.Add("Price", GetType(System.Int32))
DT.Columns.Add("ID", GetType(System.Int32))
DT.Columns.Add("Vol", GetType(System.Int32))
Dim r As DataRow = DT.NewRow
r.Item(0) = 99
r.Item(1) = 1234
r.Item(2) = 350
r.Item(3) = 1
DT.Rows.Add(r)
r = DT.NewRow
r.Item(0) = 98
r.Item(1) = 1233
r.Item(2) = 300
r.Item(3) = 1
DT.Rows.Add(r)
r = DT.NewRow
r.Item(0) = 97
r.Item(1) = 1230
r.Item(2) = 375
r.Item(3) = 1
DT.Rows.Add(r)
r = DT.NewRow
r.Item(0) = 96
r.Item(1) = 1231
r.Item(2) = 250
r.Item(3) = 1
DT.Rows.Add(r)
DT.AcceptChanges()