codegen:nullValue not working for me

  • Thread starter Thread starter mklapp
  • Start date Start date
M

mklapp

Hello,
Have a datset returning a null value in a text string
and crashes app.

Used article 318039 as a guideline to modify
dataset.xsd. (part of a WebService)

Still Get Null. Excerpt follows.
<xs:schema id="MASpedDataSet"
targetNamespace="http://www.tempuri.org/MASpedDataSet.xsd"
xmlns:codegen="urn:schemas-microsoft-com:xml-msprop"

Other namespaces follow that were produced by Gen DataSet

The other altered line:

<xs:element name="BusRider" codegen:nullValue="N"
type="xs:string" minOccurs="0" />

Have also tried nullValues of " ", _empty and "_empty".

All out of ideas (for modifying XML, I know I can use IIF
statements for each and every assign to a form control,
but will likely throw self from window after doubling
source code size as well as the time to complete each
Form.

mklapp
 
Hi mklapp,

Is the column type varchar or char? And how did you create the DataAdapter?
With code or with VS.NET wizard? And how was the typed DataSet created?
Create with drag and drop from the server explorer or generated by the
DataAdapter?

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
 
The data types are nvarchar - the result of Access 2002
upsizing wizard.

The data adapters have all been genned through the wizard.

The typed datasets were created using either the Generate
Dataset option on the data menu or the Data Adapter's
context menu.

thanks,

mklapp
 
Hi mklapp,

I'm currently researching on this issue and will update you as soon as I
get any progress.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
 
Hello,

I want to thank you for looking onto this. I would
like to know about how long you think it might be before
your research on this topic will be completed. I
understand if you cannot say yet.

Thank again,

mklapp
 
Hi mklapp,

I have taken ownership of your question and will be coordinating getting you a response from the support team. I will try to get you an ETA tomorrow. Thanks
for your patience.

Brett Keown
Microsoft Developer Support
(e-mail address removed)

To email me directly, please remove the "nospam" from my email address.

This posting is provided "AS IS" with no warranties, and confers no rights. You assume all risk for your use. © 2001 Microsoft Corporation. All rights reserved.
 
Thanks. I do appreciate that.

mklapp
-----Original Message-----
Hi mklapp,

I have taken ownership of your question and will be
coordinating getting you a response from the support
team. I will try to get you an ETA tomorrow. Thanks
for your patience.

Brett Keown
Microsoft Developer Support
(e-mail address removed)

To email me directly, please remove the "nospam" from my email address.

This posting is provided "AS IS" with no warranties, and
confers no rights. You assume all risk for your use. ©
2001 Microsoft Corporation. All rights reserved.
 
Hi Mklapp,

You should receive a response from someone on the MS Webdata Support team
either today or on Monday. If when I come in on Monday ( GMT -8) and you
haven't been responded to, I'll walk over there again and get someone to
help you out.


Brett Keown
Microsoft Support
(e-mail address removed)

This posting is provided "AS IS" with no warranties, and confers no rights.
 
Hello,
I am reaching a point in the iterative
testing/development cycle, where I must choose a way to
resolve this problem.

What is the status of this item? Can you recreate the
error? Have you recreated it but are trying to find out
why? Do you know why and are trying to decide how to fix
it?

I just would like to get a feel for the issue so I can
make my best choice.

Thank you for your efforts.

mklapp
 
Hello,

I am re-posting this as a reply to one of your posts
instead of a reply to one of mine. I do not know how you
retrieve these.

Hello,
I am reaching a point in the iterative
testing/development cycle, where I must choose a way to
resolve this problem.

What is the status of this item? Can you recreate the
error? Have you recreated it but are trying to find out
why? Do you know why and are trying to decide how to fix
it?

I just would like to get a feel for the issue so I can
make my best choice.

Thank you for your efforts.

mklapp
 
I don't see your original message. But I'm working on using
codegen:nullValue="" as well.
I've finally found that I have to include the namespace at the top to get
this to work. Just in case you're having a similar problem, try including
the namespace.
If you're having a different problem, please disregard my message.
<xs:schema id="Logging" xmlns:codegen="urn:schemas-microsoft-com:xml-msprop"
targetNamespace="http://tempuri.org/Logging.xsd"
elementFormDefault="qualified" attributeFormDefault="qualified"
xmlns="http://tempuri.org/Logging.xsd"
xmlns:mstns="http://tempuri.org/Logging.xsd"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
 
Hello,

Thanks for helping.

I had all the elements in the top of my schema that
you had. They were in a slightly different order, but I
made them match.

Still, no success, app crashes accessing null value
returned from SQL Server 2000.

How did you gen the original schema? You are getting
Null values from the DB converted to the specified
values? What kind of DB are you using? Which article
were you following when you implemented
codegen:nullValue="" ?

Thanks again.

mklapp
 
Hello,

I have done some tests and have become convinced the
generated class code for the typed data set is not being
executed.
There is a property present for the column with the
DBNull value which contains code to test for null. As I
get a null back from the column, the code was either
working improperly or not being called. I changed the
property to return a constant instead of the column's
content :
Get
If Me.IsBusRiderNull Then
Return "N"
Else
Return "F" 'Never a legal value
'Return CType(Me(Me.tableMASped.BusRiderColumn), String)
End If
End Get

if I use datarow.fieldname syntax to print the value
in the immediate wind (e.g. ? mrow.Busrider) I get
a "strong typing exception. If I use :

? dataset.tables("NAME").rows(0)("BusRider")

the immediate window will print 'DBNull" but not raise an
exception.

I still get a null, so I must believe this code is not
being executed. If it is being generated, why not
execute it. It is resident in a Web Service I am
building. Other functionality changes made in the Web
Service show up in the work, so I am pretty certain the
executable is being recompile and re-run when it is
changed, but the property code for Busrider in the
Dataset code does not appear to be executed.

mklapp
 
Hello,

I have found a second batch of class code in
WebReferences/reference.vb. In this, too, was code for
Properties. I modified the code for retrieving the field
in question and lo and behold... The null has gone away.

Apparently the Web Reference code is what is executed
when I retrieve a datarow's typed value.

I wonder why the other code is generated too.

Should I go ahead and modify the Webreference code to get
the desired performance? I am reluctant to do that.

mklapp
 
Hello,

I am able to access the dataset code in the Web
Service. If I assign a row to the strongly typed row
type for the table of the strongly types dataset, then
all works well.
If I attempt (at any time) to access the null value
through the 'conventional' path (ds.tables("name").Rows
(0).fieldName) nothing prevents the DBNull.

mklapp
 
Back
Top