OammieR
OammieR

Reputation: 2850

How to select some data from DataTable

I want to search some data from DataTable to show in GridView.

Like

(select * from customer where id="1")

Can I do that?

Upvotes: 0

Views: 1508

Answers (1)

Alex Dn
Alex Dn

Reputation: 5553

DataRow[] foundRows = yourTable.Select("id=1");

Or you can filter rows in default view:

yourTable.DefaultView.RowFilter = "id = 1";
GridView gv = new GridView();
gv.DataSourse = yourTable.DefaultView
gv.DataBind()

Upvotes: 1

Related Questions