473,388 Members | 1,408 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,388 software developers and data experts.

Blank default in XSD

All,

I am using VB.NET 1.0 / 2002. I am having trouble setting a column
default to "" (note that "" is not the same as Null / DBNull / Nothing)
in a typed dataset (to reflect the same database default)...

Below is a snippet...

<xs:element name="Customers">
<xs:complexType>
<xs:sequence>
<xs:element name="CustomerID" type="xs:string"
default="bob" />
<xs:element name="CompanyName" type="xs:string"
default="" />
<xs:element name="ContactName" type="xs:string"
minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>

If I run the below code:

Dim x As New Dataset1()

Dim y As New Dataset1.CustomersDataTable()

Dim z As Dataset1.CustomersRow = y.NewCustomersRow()

y.AddCustomersRow(z)

I get an error (Column CompanyName does not accept nulls). If I change:

<xs:element name="CompanyName" type="xs:string"
default="" />

to:

<xs:element name="CompanyName" type="xs:string"
default="Bob" />

the problem goes away (ie it correctly handles every value EXCEPT ""
(blank string)).

So my question is - how do I change the XML to reflect the fact that
the column is Required (NOT NULLable) AND has a default of "" (empty
string - not Null / DBNull / Nothing)?

Or, to state the question differently, how do I get VB.NET to put the
following line in the InitClass of the xxxDataTable class:

Me.columnCompanyName.DefaultValue = ""

(I know I can put it there myself, but then as soon as I change the XML
and regenerate the VB.NET code for the dataset my change will be lost).
I don't want to use nillable="true" since that will make it look as if
the column is NULLable (when it isn't).

Thanks
Matthew Wills

Nov 21 '05 #1
2 1391
MJWills,

I never use that myself however because that you have no answer.

Can you not make your own class, where you Inherit that created strongly
typed dataset and than override the methode where you need that setting and
set that default there

Just a thought,

Cor

Nov 21 '05 #2
Cor,

That would work - thanks for that suggestion.
Any other approach that doesn't involve inheritance?

Thanks
Matthew

Nov 21 '05 #3

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

Similar topics

6
by: Paul Robinson | last post by:
I am developing a website in ASP that connects to a Sybase database. However, when I try to open a connection to the database the page will not load. The script does not timeout, nor the...
19
by: Joe Scully | last post by:
Hi all, I am having trouble with access adding a blank record to a subform everytime I finish entering data and closing the form. (The form and subform are based on the one table) When...
2
by: JC Mugs | last post by:
I have a form that when you tab from field to field that the entry point is blank, but if you point and click in the field it brings up a 0 and data entry is started to the left of the zero. ...
8
by: MacDermott | last post by:
I have a query, which gathers up information, which is subsequently dumped into an instance of Excel using recordsetcopy. For one of the query fields, I have written what should be a pretty...
0
by: Jens Mehl | last post by:
Hi folks, our environment: Win 2003, IIS 6, SSL, ASP.NET Framework 1.1 Szenario 1: get a large page (about 1.5 MB) from asp.net with SSL/https the viewstate data within this page is about 800...
7
by: Agnes | last post by:
In my table, the datafield set to be 'allownull', However, I want to set it as blank but not null. Should I put a space in the default value in sql database ? or, During inserting record, I...
3
by: Jeff Calico | last post by:
Hello everyone I am transforming an XML document to text, basically only outputting a small portion of it. When I run the following XSLT via Xalan's processor, I get a bunch of unwanted blank...
3
by: Dabbler | last post by:
How do I display a datetime field that hasn't been assigned a value as blank instead of the default minimum value? I need to do this in both display and edit modes. Thanks!
4
by: sparks | last post by:
I am trying to fix a database that someone did about 4 yrs ago in access97. The main table just contains demographics and is on the main form of the database. It has a subform on a tab that...
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
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: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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.