Click to See Complete Forum and Search --> : DataTable and SQL Queries


zoltan_ie
April 29th, 2003, 05:58 AM
Is there an method or a way of preforming a SQL SELECT statement on a DataTable so that it returns a array of Rows?

The DataTable.Select() method won't do the job as my query is a bit too complex for me to use it.

This is my SQL query:

SELECT COUNTY_ID , NAME
FROM TOWNS
WHERE NAME IN
( SELECT NAME FROM TOWNS
GROUP BY NAME HAVING COUNT(*) > 1);

Do I need to use a SQLDataAdapter or something? Just a guideline on how I should go about doing this would be helpful.

Thanks

wolfofthenorth
April 29th, 2003, 08:35 PM
You could try using a SqlDataReader that is returned from the SqlCommand.ExecuteReader method.

Hope this helps. :D

pareshgh
April 30th, 2003, 06:46 PM
check SqlDataReader for more information.

SqlDataReader d;
// blah blah
// declaration and usage of d
object []a = new object[..]
d.GetValues(a);

Paresh