Web Service Help C# VS2005

R

Riley

I have created a dataset based on a MS Access database in a Web Service
project.. I understand the concept of Web methods, however, I do not
understand the code I need to write to return this entire (or a subset)
dataset back to the consumer. Could someone please post the code to do this,
and/or send me to a good tutorial.? I dont seem to be able to find a proper
walkthru on the subject. Thanks so much in advance
 
R

RYoung

I just noticed this on MSDN:
http://msdn2.microsoft.com/en-us/library/ms978686.aspx

If you read through it, the scenario goes through a contract first style of
service development in regards to the data transfer objects.

Steps 1, 2, and 3 of that article describe what your looking for.

It doesn't return datasets, but that's irrelevant to the "message" being
sent out from the service.

Basically:
1) Define your "messages" in Xml Schema first, using Visual Studio's XSD
designer.
2) Use xsd.exe to generate classes based on those schemas, add the generated
code to your project.
3) Define the service operations (WebMethods) that accept and return data of
those types.

At that point, how the generated classes get populated with information is
up to you. You can hit the database to fill a dataset, then create an
instance of one of the response messages and populate it with data from the
dataset.

Ron
 
J

John Saunders

RYoung said:
I just noticed this on MSDN:
http://msdn2.microsoft.com/en-us/library/ms978686.aspx

If you read through it, the scenario goes through a contract first style
of service development in regards to the data transfer objects.

Steps 1, 2, and 3 of that article describe what your looking for.

Robert has pointed you to "contract-first" development, which is how I
happen to prefer web services. So I'm playing Devil's Advocate here when I
show you the other way!

[WebMethod]
public DataSet MyMethod(int id)
{
dataAdapter.SelectCommand.Parameters[0].Value = id;
DataSet dataSet = new DataSet();
dataAdapter.Fill(dataSet);

return dataSet;
}


John
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,818
Latest member
Brigette36

Latest Threads

Top