473,597 Members | 2,190 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

webservice and typed datasets

Hi,

I'm delevloping a webservice that returns typed datasets with visual
studio 2005. The problem is, that the typed data set in the client app
is not the same as in the webservice. If I change the property
'NullValue' of the row to (empty) the dataset on the client does still
throw an exception. I added a column to see if the project updates the
reference.cs - and it does!

This is the generated code from the original dataset:
[System.Diagnost ics.DebuggerNon UserCodeAttribu te()]
public string Firstname {
get {
if (this.IsFirstna meNull()) {
return string.Empty;
}
else {
return
((string)(this[this.tableAuthU sers.FirstnameC olumn]));
}
}
set {
this[this.tableAuthU sers.FirstnameC olumn] = value;
}
}

And this the code in the reference.cs:
[System.Diagnost ics.DebuggerNon UserCodeAttribu te()]
public string Firstname {
get {
try {
return
((string)(this[this.tableAuthU sers.FirstnameC olumn]));
}
catch (System.Invalid CastException e) {
throw new
System.Data.Str ongTypingExcept ion("Der Wert für Spalte Firstname in
Tabelle AuthUsers ist DBNull.", e);
}
}
set {
this[this.tableAuthU sers.FirstnameC olumn] = value;
}
}
Is this a bug or is it expected behavior? Can anyone tell me how to
work around?
Thanks in advance.

Mike

Dec 4 '06 #1
3 2487
Hi Mike,

The setting for how a Typed DataSet will handle string DataColumns with a
value of DBNull is only used when the DataSet is first created by the
MSDataSetGenera tor. The setting is not present in the schema for the
DataSet (it's only a setting that the generator understands).

When the DataSet is stubbed out on the client the null-handling setting for
string DataColumns isn't retained since it's not part of the DataSet's
schema.

I don't think this is a bug, since standardized Web Services shouldn't have
to make an exception to process DataSets differently because of a missing
feature in the xsd standards.

Anyone consuming the DataSet should first check the IsFirstnameNull method
before attempting to read the Firstname property. This is the usual way of
coding against a Type DataSet so it shouldn't be unintuitive for developers
that are using your Web Service.

--
Dave Sexton

"Mike" <m.********@sls ervices.dewrote in message
news:11******** **************@ 73g2000cwn.goog legroups.com...
Hi,

I'm delevloping a webservice that returns typed datasets with visual
studio 2005. The problem is, that the typed data set in the client app
is not the same as in the webservice. If I change the property
'NullValue' of the row to (empty) the dataset on the client does still
throw an exception. I added a column to see if the project updates the
reference.cs - and it does!

This is the generated code from the original dataset:
[System.Diagnost ics.DebuggerNon UserCodeAttribu te()]
public string Firstname {
get {
if (this.IsFirstna meNull()) {
return string.Empty;
}
else {
return
((string)(this[this.tableAuthU sers.FirstnameC olumn]));
}
}
set {
this[this.tableAuthU sers.FirstnameC olumn] = value;
}
}

And this the code in the reference.cs:
[System.Diagnost ics.DebuggerNon UserCodeAttribu te()]
public string Firstname {
get {
try {
return
((string)(this[this.tableAuthU sers.FirstnameC olumn]));
}
catch (System.Invalid CastException e) {
throw new
System.Data.Str ongTypingExcept ion("Der Wert für Spalte Firstname in
Tabelle AuthUsers ist DBNull.", e);
}
}
set {
this[this.tableAuthU sers.FirstnameC olumn] = value;
}
}
Is this a bug or is it expected behavior? Can anyone tell me how to
work around?
Thanks in advance.

Mike
Dec 4 '06 #2
Hi Mike,
I don't think this is a bug, since standardized Web Services shouldn't
have to make an exception to process DataSets differently because of a
missing feature in the xsd standards.
On second thought, this does appear to be a bug.

I tested it myself and the xsd generated by the Web Service for a DataSet
does include "msdata" namespace attributes. So, I don't see why the
"msprop" namespace isn't included as well. msprop:nullValu e="_empty" is the
setting to which you referred in your OP, so it could have been added to the
xsd for the Typed DataSet just as easily as the msdata attributes.

--
Dave Sexton

"Dave Sexton" <dave@jwa[remove.this]online.comwrote in message
news:Oh******** ******@TK2MSFTN GP02.phx.gbl...
Hi Mike,

The setting for how a Typed DataSet will handle string DataColumns with a
value of DBNull is only used when the DataSet is first created by the
MSDataSetGenera tor. The setting is not present in the schema for the
DataSet (it's only a setting that the generator understands).

When the DataSet is stubbed out on the client the null-handling setting
for string DataColumns isn't retained since it's not part of the DataSet's
schema.

I don't think this is a bug, since standardized Web Services shouldn't
have to make an exception to process DataSets differently because of a
missing feature in the xsd standards.

Anyone consuming the DataSet should first check the IsFirstnameNull method
before attempting to read the Firstname property. This is the usual way
of coding against a Type DataSet so it shouldn't be unintuitive for
developers that are using your Web Service.

--
Dave Sexton

"Mike" <m.********@sls ervices.dewrote in message
news:11******** **************@ 73g2000cwn.goog legroups.com...
Hi,

I'm delevloping a webservice that returns typed datasets with visual
studio 2005. The problem is, that the typed data set in the client app
is not the same as in the webservice. If I change the property
'NullValue' of the row to (empty) the dataset on the client does still
throw an exception. I added a column to see if the project updates the
reference.cs - and it does!

This is the generated code from the original dataset:
[System.Diagnost ics.DebuggerNon UserCodeAttribu te()]
public string Firstname {
get {
if (this.IsFirstna meNull()) {
return string.Empty;
}
else {
return
((string)(this[this.tableAuthU sers.FirstnameC olumn]));
}
}
set {
this[this.tableAuthU sers.FirstnameC olumn] = value;
}
}

And this the code in the reference.cs:
[System.Diagnost ics.DebuggerNon UserCodeAttribu te()]
public string Firstname {
get {
try {
return
((string)(this[this.tableAuthU sers.FirstnameC olumn]));
}
catch (System.Invalid CastException e) {
throw new
System.Data.Str ongTypingExcept ion("Der Wert für Spalte Firstname in
Tabelle AuthUsers ist DBNull.", e);
}
}
set {
this[this.tableAuthU sers.FirstnameC olumn] = value;
}
}
Is this a bug or is it expected behavior? Can anyone tell me how to
work around?
Thanks in advance.

Mike


Dec 5 '06 #3
Hi Dave,

Thanks for the replay. I guess this is a bug, too. The problem is that
it is not possible to use standard data binding with the object data
source in web forms. The only thing that I figured out to work around
is to merge the dataset into a new one. But this is not very handy and
you loose all benefits of the typed dataset.
It's very hard for me to believe, that I'm the first one who tries to
use typed datasets, web services and data binding. These are the new
Microsoft standards for n-tier applications, no?

Mike

Dec 5 '06 #4

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

Similar topics

3
2148
by: Trygve Lorentzen | last post by:
Hi, I don't know if this is a stupid question, but I observe that my webservice is created for each call to a webmethod. More precisely an instance of the webservice class is created for each call. This makes the InitializeComponent() method run for each method call and seems to really slow things down. Can I keep the webservice object running after a method call? Trygve
4
8266
by: Adrian Meyer | last post by:
Hi, On the server I code the following web service: ))] public XmlDataDocument GetTypedXmlDataDocument() { sqlDataAdapter1.Fill(typedDataSet1); XmlDataDocument dataDoc
22
25569
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 compile. <WebMethod()> _ Public Function VerifySku(ByVal skus As XmlDataDocument) As DataSet Test program : Dim cartSet As DataSet cartSet = ws.VerifySku(cartSet)
0
224
by: Chertzy B | last post by:
Datasets in Whidbey (Beta 2) contain a namespace property suggesting that it is possible to web enable them. However, it seems very difficult to do this. Take the following scenario 3 projects in a solution WidgetWindows (a windows application) WidgetLibrary (a project containing datasets)
1
2912
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 like those found in the Duwamish 7 sample 2. WebServices project - wraps up business logic 3. C# winforms consumer connecting to the WebServices. This project has the data project as a reference.
2
1419
by: Deecrypt | last post by:
Hi, I'm a newbie to the Web Services topic. I have an ASP.NET website and am trying to send a Dataset from it to a WebService which should insert all the data from this DataSet to an Access database. Also I'm working with untyped datasets. I have read some topics in this newsgroup. One suggested to convert the DataSet to a string using ReadXML, send the string to the WebService, create a new Dataset and read the string back into the...
4
9909
by: Ronald S. Cook | last post by:
I've always used untyped datasets. In a Microsoft course, it walks through creating typed datasets and harps on the benefits. It has you drag all these things around ..wizard, wizard, wizard... code gen, code gen, code gen. What's at the end looks slick, but then there's a ton of generated code that I'm going to have to maintain now. I.e. I like typing things myself (don't like wizards) so I can know exactly what I've done.
21
2406
by: Peter Bradley | last post by:
Hi all, This post is sort of tangentially related to my earlier posts on configuration files for DLLs. Does anyone know how to create typed DataSets using VS2005's new DataSet designer, but with the ability to configure the connection string via a config file? The designer seems to hard-code the connection string into the dataset itself, which just can't be right.
12
3576
by: BillE | last post by:
I'm trying to decide if it is better to use typed datasets or business objects, so I would appreciate any thoughts from someone with more experience. When I use a business object to populate a gridview, for example, I loop through a datareader, populating an array list with instances of a custom class in the middle tier, and then send the array list up to the presentation layer and bind the gridview to it. If I use a typed dataset, I...
0
7970
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
7887
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8274
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8381
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8036
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8259
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5434
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
3930
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1241
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.