Solved

ODS cast to dataset

Posted on 2006-11-08
3
384 Views
Last Modified: 2011-08-18
How do I cast an objectdatasource.select() to a dataset?
0
Comment
Question by:acdagirl
[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
  • 2
3 Comments
 
LVL 15

Expert Comment

by:ozymandias
ID: 17902078
I don't thinb you can cast it to a dataset since the return type is IEnumerable and DataSet does not implement this interface AFAIK.
0
 

Author Comment

by:acdagirl
ID: 17906210
i thought the ods.select method could return a datatable, from which you could get a dataset?
either way, I'm just trying to pass the object datasource dataset/view/table in a session to another page instead of reloading it. I guess I can just call the datatable I have in the business logic layer that calls the datatable and avoid the object datasource altogether...
0
 
LVL 15

Accepted Solution

by:
ozymandias earned 500 total points
ID: 17906395
You are correct...the ods.select method *COULD* return a datatable, but it could also return any object that implements IEnumerable.

If you want to try it, do this :

object obj = objectdatasource.select();
if (obj is DataTable){
    // we have a data table
    DataSet data = new DataSet();
    DataTable table = (DataTable)obj;
    data.Tables.Add(table);
    // now you have a dataset with your datatable int it
   // do your stuff
}else{
    /// ooops
    System.Diagnostics.Debug.WriteLine("Object retirned by objectdatasource was not a datatable is was a " + obj.GetType.ToString());
}
0

Featured Post

Want Experts Exchange at your fingertips?

With Experts Exchange’s latest app release, you can now experience our most recent features, updates, and the same community interface while on-the-go. Download our latest app release at the Android or Apple stores today!

Question has a verified solution.

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

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…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

636 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