Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
AddRow and defaults/nulls
Message
De
29/03/2003 10:46:12
 
Information générale
Forum:
ASP.NET
Catégorie:
ADO.NET
Divers
Thread ID:
00771678
Message ID:
00771715
Vues:
8
Rick,

I'm pretty sure that there's a way to set up defaults in your DataSets so that it will respect those when you add a new row. I haven't done it however (we just let it add all nulls, even though DBNulls are a major PITA, most of our backend data allow NULLs), so I'm not sure where you would do this. Maybe someone else knows ...

~~Bonnie


>Hi all,
>
>I'm looking for some best practices ideas on how to deal with adding new
>values to a DataSet after I've pulled some data down.
>
>The biggest issues I have are:
>
>* AddRow adds everything with nulls
>* I get no default values from the database
>* The dataset updates propagate the nulls to the server so
> even on the Insert that occurs the default values aren't set.
>
>Short of manually executing Insert Statements and reading the data back is
>there a better way to have the Dataset respect the database settings and
>constraints defined in the database (SQL Server)?
>
>Right now as it stands I have a routine that initializes most values to
>non-null values then explicitly follow up the fields that need to have
>specific values (or null) set. It's not a big deal, but this sort of thing seems very inefficient requriing lots of extra code... (well actually my BO has some code that can do this automatically setting everything to VFP style blanks rather than nulls).
>
>Dealing with NULLS in ADO.NET is a PITA too because you have use DBNull for all comparisons etc. so I'm even less inclined to ever use NULLs in any data except those that REALLY require it for knowledge of previously unset values (most don't).
>
>
>Any ideas?
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform