473,387 Members | 1,553 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Passing an object containing multiple DataSet's to a WebMethod

Hi,

My problem is the following: i have a class like:
[Serializable]
class c{
public DataSet m_dsFirst;
public DataSet m_dsSecond;
public string m_sName;
void c()
{
m_sName="Test";
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,
MuZZy
Mar 24 '06 #1
1 1420
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:

=========================

...................

[WebMethod]
public MyData GetCompData()
{
MyData md = new MyData();

DataSet ds1 = new DataSet("ds1");
DataTable dt1 = new DataTable("dt1");
dt1.Columns.Add("name");

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

dt1.Rows.Add(dr);

ds1.Tables.Add(dt1);

md.ds1 = ds1;

md.ds2 = ds1.Copy();

md.name = "md1";

return md;

}
..................
public class MyData
{
public DataSet ds1;
public DataSet ds2;
public string name;

public MyData()
{ }

}

===========================
Regards,

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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Sahil Malik [MVP] | last post by:
Okay so now I understand (surprised though) - that WebServices can indeed pass ByRef/ref parameters. All I have to do is mark an integer parameter of a WebMethod as "ref". Funnily enough, this is...
4
by: Gr8North | last post by:
I'm relatively new to .Net, and would appreciate a little assistance. I have multiple datasets attached to individual grids on individual tabs on a form. I would like to have a series of...
22
by: Arne | last post by:
How do I pass a dataset to a webservices? I need to submit a shoppingcart from a pocket PC to a webservice. What is the right datatype? II have tried dataset as a datatype, but I can't get it to...
6
by: rlcavebmg | last post by:
I am new to Web Services and .NET development, and I have a question. I am writing a service that will create a bitmap image and return it to the client. First, I wrote a method that looked like...
2
by: SP | last post by:
Hello All, I have a web method in a web service as follows: public SqlDataReader Display_test_data() { string connectionInfo = ConfigurationSettings.AppSettings;
1
by: J. Askey | last post by:
I am implementing a web service and thought it may be a good idea to return a more complex class (which I have called 'ServiceResponse') in order to wrap the original return value along with two...
5
by: John | last post by:
Hi Is it possible to pass a whole record to a webmethod? How? Thanks Regards
1
by: rival | last post by:
Hi. I've a single solution with many projects. I'm using VS2003 and framework 1.1 1. Data project - contains UserData class, inheriting from DataSet, and setting up constants and columns...
7
by: =?iso-8859-1?Q?S=F8ren_M._Olesen?= | last post by:
Hi How do I pass a complex type to a webservice?? What I have is a Class 'MyComplexClass' which lives in it's own dll/namespace. I'd like to pass this class to my webmethod: <WebMethod()_...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.