|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Trouble with DefaultValue on Typed DataSetUsing 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. 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. -- Show quoteGregory A. Beamer MVP; MCP: +I, SE, SD, DBA *************************** Think Outside the Box! *************************** "Harry Keck" wrote: > 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. |
|||||||||||||||||||||||