Wednesday, March 7, 2012

Query on dataset

I have a dataset filled with data.
I want to get a particular (row,column) value from the dataset.

How do I query on the dataset if the query is
firstname, lastname where employeeid='1234'?

I feel like I have missed the point, but maybe something like:

select firstName,
lastName
from dataset
where employeeId = '1234'

?

Dave

|||What do you mean...dataset? Is this a .NET programming question? Or query in SQL question? Can you post the code you have so far?|||I'm not trying to query the database and fill a dataset.

I get a dataset already containing data and I need to query on the dataset to get a specific value from the dataset.
I know Dataset.Select() exists.
But it does not allow me to pick a (row,column) value based on a criteria.

For example, if the database contains FirstName, LastName, Salary and DOJ in it.
I want to pull only the firstname and lastname of people who joined on maybe 01/06/2006.|||Dave,

This query would work on database and i'm trying to do similar query on a 'DATASET'|||

Krutika:

"Dataset.Select ()" looks to me like a member function; if that is the case this post probably ought to be place in another location to get a better response.

Dave

|||which forum should I place this in?|||

I think you can't directly use Select on a DataSet, but you can do it on a DataTable. So it should look like this :

expression = "EmployeeId = '1234'"

DataSet.Table[0].Select(expression)

Then you'll get an array of DataRows.

you can look at this article : http://msdn2.microsoft.com/en-us/library/det4aw50.aspx

|||Thanks this worked

No comments:

Post a Comment