Solved

c# query a .NET dataset

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

[Webinar] Code, Load, and Grow

Managing multiple websites, servers, applications, and security on a daily basis? Join us for a webinar on May 25th to learn how to simplify administration and management of virtual hosts for IT admins, create a secure environment, and deploy code more effectively and frequently.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
asp web application 3 55
C# Formatting DateTime String Value 5 68
Making exceptions for ValidationAttribute 2 43
Manage big list of parameter list 8 25
This article describes a simple method to resize a control at runtime.  It includes ready-to-use source code and a complete sample demonstration application.  We'll also talk about C# Extension Methods. Introduction In one of my applications…
Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
This video shows how to use Hyena, from SystemTools Software, to update 100 user accounts from an external text file. View in 1080p for best video quality.

739 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