Click here to Skip to main content
15,893,814 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Helloo ,

Can anyone help me i got this issue ,how solve this
Posted
Comments
gagan sawaliya 5-Feb-13 7:13am    
post some code

If you need to return a DataSet, and all you have is a DataTable, you can add the DataTable to a dummy DataSet and return that. Here's an example:
C#
public DataSet DoSomething()
{
  DataTable people = GetPeopleWhoMatchSomeCriteria();
  DataSet dummySet = new DataSet();
  dummySet.Tables.Add(people);
  return dummySet;
}
The alternative is to change the return type from DataSet to DataTable.
 
Share this answer
 
Comments
thatraja 5-Feb-13 13:59pm    
5Hi Pete!
Pete O'Hanlon 5-Feb-13 14:08pm    
How do mate? How are you doing?
thatraja 5-Feb-13 14:29pm    
I'm OK, It's been long time, hope you're doing great. I come back here today....(I was inactive here)
Pete O'Hanlon 5-Feb-13 14:51pm    
I'm fine thanks. Busy busy. Hope you're keeping well.
Sergey Alexandrovich Kryukov 5-Feb-13 23:53pm    
Answered without repeating what the compiler already told to him :-), a 5.
—SA
you can't cast a DataTable to DataSet.
 
Share this answer
 
Comments
Pete O'Hanlon 5-Feb-13 7:43am    
That doesn't really help solve the issue though, does it? You're just telling him what the compiler already told him.
scarletwitch1990 5-Feb-13 23:12pm    
actually, im completely new to Asp.Net...so my knowledge is limited....but thanks anyway for your solution.
No one told me the alternate method

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900