Solved

c# query a .NET dataset

Posted on 2003-12-01
5
6,031 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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Introduction Although it is an old technology, serial ports are still being used by many hardware manufacturers. If you develop applications in C#, Microsoft .NET framework has SerialPort class to communicate with the serial ports.  I needed to…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.

809 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