Trouble with DefaultValue on Typed DataSet

G

Guest

Using the Visual Studio designer, I can easily create a typed dataset. It is
possible to set default values for table columns by setting the default in
the designer. I can do this easily for boolean and integer types, but if I
have a string field and I want to set the default to "", I can not find a way
to do this. If I go into the auto generated cs file and make the change, it
gets wiped out if I ever make any other changes in the designer. Is there a
way to set the DefaultValue of a string column to be empty string for typed
datasets created using the Visual Studio designer? Thank you.
 
G

Guest

Think this through for a second. A strongly typed dataset is an XSD file (a
type of XML). How does it represent an empty string? How does it represent a
null value? Starting to see the issue?

As this is pure XML text, '' and NULL are equivalent. If you allow nulls,
setting a '' default is the same as no default. If you do not allow nulls,
you are saying "set the default to null (empty string)".

BTW, this is a limitation of XML, not .NET. You have to figure out another
creative way to solve this issue.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

***************************
Think Outside the Box!
***************************
 

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

Top