Sometimes Code
Sometimes Code

Reputation: 601

can i fire a sql query on the table of Dataset?

I know this is very stupid thing to ask. But i am not as genius as you all. if i have a dataset as give below:-

adapter.fill(ds,"Login");

Now the table created in Dataset is "Login". Now can i fire a sql command over this table like

sqlcommand cmd = new sqlcommand("select * from Login");

Upvotes: 4

Views: 9475

Answers (2)

Sagar Hirapara
Sagar Hirapara

Reputation: 1697

yes you can do it as follow

dataset ds=new Dataset

    datatable dt=ds.table[0].select(" select * from tablename")

    or

    datatable dt=ds.table["tablename"].select(" select * from tablename")

Upvotes: 0

John Woo
John Woo

Reputation: 263693

you can filter the data table, eg

ds.Tables["Login"].Select("ID=1 AND ID2=3"); // sample expression

more on this link

Upvotes: 8

Related Questions