PC Review


Reply
Thread Tools Rate Thread

DataTable select where string starts with...

 
 
George
Guest
Posts: n/a
 
      2nd Feb 2005
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.
 
Reply With Quote
 
 
 
 
=?Utf-8?B?VGFtZXI=?=
Guest
Posts: n/a
 
      2nd Feb 2005
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



"George" wrote:

> 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.
>

 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
DataTable.Select - Thread.CurrentThread.CurrentCulture - String.Format Rainer Queck Microsoft C# .NET 5 6th Jan 2008 01:13 PM
DataTable.Select() if apostrophes in match-string John Grandy Microsoft ADO .NET 1 18th Aug 2005 10:04 PM
Bug in DataTable.Select(string) Dallara Microsoft ADO .NET 0 5th Nov 2004 05:45 AM
Select string as a column name in datatable? =?Utf-8?B?Sm9uYXRoYW4=?= Microsoft VB .NET 3 9th Oct 2004 08:05 AM
DataTable.Select(string filter) Nico Microsoft ADO .NET 0 26th Aug 2003 12:04 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:20 PM.