473,418 Members | 2,052 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,418 software developers and data experts.

Return Strongly Typed Data Set from Web Service

I've created a strongly typed DataSet (Customers.xsd) using the xsd.exe
tool. I want to be able to access fields using
ds.Customer[0].CompanyName.

The problem is when I return this DataSet from a Web Service it adds
another Table to the DataSet that contains the data. I have to access
the data using ds.Tables[1].Rows[0]["CompanyName"].ToString(). This
defeats the whole purpose of using a strongly typed DataSet.

Thanks in advance for the help.

Nov 17 '05 #1
1 2157
"HardBap" <ha*****@gmail.com> wrote in message
news:11**********************@o13g2000cwo.googlegr oups.com...
I've created a strongly typed DataSet (Customers.xsd) using the xsd.exe
tool. I want to be able to access fields using
ds.Customer[0].CompanyName.

The problem is when I return this DataSet from a Web Service it adds
another Table to the DataSet that contains the data. I have to access
the data using ds.Tables[1].Rows[0]["CompanyName"].ToString(). This
defeats the whole purpose of using a strongly typed DataSet.

Thanks in advance for the help.


I would advise against that approach. The web service proxy has trouble
with custom data types, which is what your strongly typed dataset really is.
You can make it work, but you have to remember to edit the proxy every time
you update your web service reference.

What I wound up doing, and it works very well, is to return generic datasets
from the web service. That way you never have to manually edit the proxy
class. Then, in my business logic layer, I load the generic dataset into a
strongly typed dataset that is then ready for binding, manipulating, etc.
It loads really fast, just use this command:

// load the generic data from the data layer into a strongly typed dataset
dsStronglyTyped.Load(dsGeneric.Tables[0].CreateDataReader(),
LoadOption.OverwriteChanges,
dsStronglyTyped.mytablename);

HTH,

Mike Rodriguez

Nov 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Mark | last post by:
Just wanted to confirm that my understanding of a strongly typed language is correct: 1. .NET is a strongly typed language because each variable / field must be declared a specific type (String,...
2
by: David | last post by:
I have been developing applications with Java for quite a while but I am new to .NET development. I am trying to learn the ".NET way" of creating Strongly Typed Objects from a database. The...
1
by: HardBap | last post by:
I've created a strongly typed DataSet (Customers.xsd) using the xsd.exe tool. I want to be able to access fields using ds.Customer.CompanyName. The problem is when I return this DataSet from a...
20
by: Dennis | last post by:
I use the following code for a strongly typed arraylist and it works great. However, I was wondering if this is the proper way to do it. I realize that if I want to implement sorting of the...
2
by: chris | last post by:
Hello all, Background: Using .NET 2.0, Sql Server 2005, SqlCacheDependency is utilized successfully against SqlCommand objects elsewhere in the code (in other words I have successful instances...
0
by: John Davis | last post by:
Hi all, hope you are well. I would like to know if I can access the strongly typed properties of my datatable when binding through the ObjectDataSource object. I am currently creating some...
0
by: John Davis | last post by:
Hi all, hope you are well.(not sure if this posted the first time) I would like to know if I can access the strongly typed properties of my datatable when binding through the ObjectDataSource...
4
by: Rachana | last post by:
Hi, I have understood Data Sets but what is meant by typed/untyped/ strongly typed datasets. Can any one explain me or suggest any site/ article, to get these concepts (and their ...
5
by: TompIfe | last post by:
Hi, I have a web service that reads data from an Access database using datareader and place the data in an array that the web method returns. Now, I want to make the web service also to return an...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.