DataTable select where string starts with...

  • Thread starter Thread starter George
  • Start date Start date
G

George

Hi,

Is it possible to select rows from a table where a string
starts with certain characters?

i.e. myTable.Select ("Column1='a*'", ...

Many thanks.
 
Hi,
actually yes you can do this but you will need a dataview
VB :
Dim tbl As New DataTable("Customers")
Dim dv As new DataView(tbl)
dv.RowFilter = "CustomerID LIKE 'A%'"
datagrid.datasource = dv
C#
DataTable tbl = New DataTable("Customers");
DataView dv = New DataView(tbl);
dv.RowFilter = "CustomerID LIKE 'A%'";
datagrid.datasource = dv;
after that u can bind ur dataview to datagrid you can loop throught the rows
you can do whatever u want
 
Back
Top