DefaultValue and Caption in Dataset Designer

P

Paul Craig

Hi everyone,
Just wondering if someone can explain to me the reasoning behind (and a
possibly workaround) why the DefaultValue and the Description (Caption)
values dont come across to the dataset from a given database. I am using SQL
Server 2000 and have this probhlem in both Visual Studio 2003 and 2005. To
recreate the problem, create a table in SQL Server and give any of the
fields a description and a default value. In visual studio 2005 in the
Dataset Designer add the table you just created. You will see that the
default values and description (caption) for the fields have not been
transferred across into the tableadapter.

Putting constraints such as default values should all be done at the
database level not at the application level and it seems like poor
implementation that these values do not come across automatically. We use
the default value widely in our databases to ensure that null values are not
entered into any of the columns by giving a default value of (''). Having to
go through and add these default values to all columns seems like promoting
very poor design.

Any help is greatly appreciated,
Paul
 
G

Guest

I am having the same problem, plus the AllowDBNull does not come across
either. This is just ridiculous. In the Server Explorer, selecting a field
shows "Nullable: False" in the properties, but clicking on the same field in
the DataTable shows "AllowDBNull:True".

Not only that, these fields that should not allow nulls at all get set to
null when creating a new row, and (by default) throw an exception if you try
and save!

I manually went and set all these fields to "AllowDBNull:False", but I
needed to add a column, and when I used the "Configure..." menu to get the
new field, it reset them all back to "AllowDBNull:True".

I can't understand how the setting of these core properties (DefaultValue,
AllowNull) could have been overlooked.

Ben
 

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