By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,783 Members | 1,347 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,783 IT Pros & Developers. It's quick & easy.

Query datatable using SQL

P: n/a
I have a DataSet with a DataTable that I created from a text file.
Now I would like to run querys against the table using SQL. Something
like:
SELECT tblTemp.col1, tblTemp.col2, tblTemp.col3
FROM tblTemp
WHERE (((tblTemp.col1) Like "*A") AND ((tblTemp.col3) Like "*e"));
Is this possible without saving to a database? My searches are turning
up nothing.

May 15 '06 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Marty,

It isn't possible to perform this operation on the DataTable. You might
be able to get away with this using a DataView, and setting the RowFilter
property to a filter (I believe that it supports LIKE).

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Marty" <mc******@gmail.com> wrote in message
news:11*********************@j73g2000cwa.googlegro ups.com...
I have a DataSet with a DataTable that I created from a text file.
Now I would like to run querys against the table using SQL. Something
like:
SELECT tblTemp.col1, tblTemp.col2, tblTemp.col3
FROM tblTemp
WHERE (((tblTemp.col1) Like "*A") AND ((tblTemp.col3) Like "*e"));
Is this possible without saving to a database? My searches are turning
up nothing.

May 15 '06 #2

P: n/a
You cannot get a different set of columns, but you can get a filter set
of rows using the DataTable.Select method.

DataTable myTable = .....
DataRow[] rows = myTable.Selelct(@"((tblTemp.col1) Like ""*A"") AND
((tblTemp.col3) Like ""*e"")");

May 15 '06 #3

P: n/a
That'll work. Thanks all!

May 15 '06 #4

P: n/a
That'll work. Thanks all!

May 15 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.