Solved

c# query a .NET dataset

Posted on 2003-12-01
5
6,028 Views
Last Modified: 2007-12-19
I have a .NET dataset in c# and would like to write SQL to query it and get back another dataset. Is this possible and how can I do it?
0
Comment
Question by:newstandard
  • 3
5 Comments
 
LVL 20

Expert Comment

by:TheAvenger
ID: 9850286
You can do something like this in a DataTable. Would this help you?
0
 
LVL 6

Expert Comment

by:DaniPro
ID: 9850302
I'm not sure that I understand very well wath you need, but you can try to use the Select method:

DataRow[] foundRows = YourDataTable.Select("Date > '1/1/00'");

0
 
LVL 20

Expert Comment

by:TheAvenger
ID: 9850319
I meant the same, but it's only for DataTable, Dani. So newstandard shall say if data table is enough or not
0
 
LVL 1

Accepted Solution

by:
mvannata earned 250 total points
ID: 9850326
hey newstatndard,
Give this a try,
you can uses the clone method of the dataset and then the select method to create a subset of the data.

private void GetClone(DataSet myDataSet)
{
   // Get a clone of the original DataSet.
   DataSet cloneSet;
   cloneSet = myDataSet.Clone();
   DataTable dt = cloneSet.Tables[0];
   string sWhere  = "column > 'a Value'";
   string sSort = "column DESC";
   ds.Select(sWhere, sSort);
}

That will give you a second dataaset based upon the first and allow you to generate a subset.
0
 
LVL 20

Expert Comment

by:TheAvenger
ID: 9850370
Since when has DataSet a Select method?!?!
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Article by: Ivo
C# And Nullable Types Since 2.0 C# has Nullable(T) Generic Structure. The idea behind is to allow value type objects to have null values just like reference types have. This concerns scenarios where not all data sources have values (like a databa…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This is a video that shows how the OnPage alerts system integrates into ConnectWise, how a trigger is set, how a page is sent via the trigger, and how the SENT, DELIVERED, READ & REPLIED receipts get entered into the internal tab of the ConnectWise …
Concerto provides fully managed cloud services and the expertise to provide an easy and reliable route to the cloud. Our best-in-class solutions help you address the toughest IT challenges, find new efficiencies and deliver the best application expe…

929 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now