By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,501 Members | 2,805 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,501 IT Pros & Developers. It's quick & easy.

Passing an object containing multiple DataSet's to a WebMethod

P: n/a

My problem is the following: i have a class like:
class c{
public DataSet m_dsFirst;
public DataSet m_dsSecond;
public string m_sName;
void c()
m_dsFirst = <some dataset>;
m_dsSecond = <some other dataset>;

Now, when i pass an object of this class as a return value of a web
method (or as an argument to a web method), it doesn't serialize those
datasets, all i see is m_sName.

How do i use such a class with web services?

Thank you,
Mar 24 '06 #1
Share this Question
Share on Google+
1 Reply

P: n/a
Hi MuZZy,

Welcome to the MSDN newsgroup.

From your description, I understand that you're developing an ASP.NET
webservice and in one of the webmethod, you return an comnplex type object
which contains some DataSet as its public members. However, you find that
the webservcie client can only get other fields rather than the DataSet
members, correct? If anything I missed ,please feel free to let me know.

Based on my local test, such type which contains DataSet object as member
can be correctly transfered from server to client through webservice. I'm
thinking whether this is a class or project specific issue. Have you tried
this in other webservice application to see whether they also suffer such
problem? Also, here is the test application's code, you can have a test on
your side to see whether it works:



public MyData GetCompData()
MyData md = new MyData();

DataSet ds1 = new DataSet("ds1");
DataTable dt1 = new DataTable("dt1");

DataRow dr = dt1.NewRow();
dr[0] = "Name1";



md.ds1 = ds1;

md.ds2 = ds1.Copy(); = "md1";

return md;

public class MyData
public DataSet ds1;
public DataSet ds2;
public string name;

public MyData()
{ }



Steven Cheng
Microsoft Online Community Support

When responding to posts, please "Reply to Group" via your newsreader so
that others may

learn and benefit from your issue.

This posting is provided "AS IS" with no warranties, and confers no rights.
Mar 24 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.