Solved

c# query a .NET dataset

Posted on 2003-12-01
5
6,040 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

[Live Webinar] The Cloud Skills Gap

As Cloud technologies come of age, business leaders grapple with the impact it has on their team's skills and the gap associated with the use of a cloud platform.

Join experts from 451 Research and Concerto Cloud Services on July 27th where we will examine fact and fiction.

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…
This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…

617 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