Sql Query on a datatable

T

Tomer

Hi,

I have a datatable filled with data, and I need to fill another datatable
from it by using a sql query. is this possible? if not was is the best (
fastest ) way to do this. In the select query I need to use the 'group by'.

Thanks, Tomer!
 
I

Ilya Tumanov [MS]

Do you mean DataTable class in System.Data?
If so, you can not use SQL with it (unless you're willing to write your own
SQL query processor).

However, you can select and filter records in the DataTable with SQL-like
queries.
Look into DataTable.Select() method to do that.
Also consider using DataView class which allows you to create sorted and
filtered views of your data without creating a copy.

Finally, you can use SQL CE which would allow you to execute actual SQL
queries.

Best regards,

Ilya

This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top